此应用程序没有明确的映射/错误 [英] This application has no explicit mapping for /error

查看:2870
本文介绍了此应用程序没有明确的映射/错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用maven做教程 https://spring.io/guides/gs/uploading-files/

所有我使用的代码都被复制了。

应用程序可以运行,但是我得到这个错误:


白标签错误页面此应用程序没有明确的映射/错误,所以您将此视为后备。
Tue Jun 30 17:24:02 CST 2015有一个意外的错误(type = Not Found,status = 404)。
没有消息可用


我该如何解决它?

解决方案

确保您的主类位于其他类之上的根包中。
$ b

运行Spring Boot应用程序时,即一个用@SpringBootApplication注解的类),Spring将只扫描你的主类包下面的类。

  com 
+ - APP
+ - Application.java< ---你的主类应该在这里,高于你的控制器类
|
+ - 型号
| + - user.java
+ - controller
+ - UserController.java


I used maven to do the tutorial https://spring.io/guides/gs/uploading-files/
All the codes I used was copied.

The Application can run, but I get the error:

Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Tue Jun 30 17:24:02 CST 2015 There was an unexpected error (type=Not Found, status=404). No message available

How can I fix it?

解决方案

Make sure that your main class is in a root package above other classes.

When you run a Spring Boot Application, (i.e. a class annotated with @SpringBootApplication), Spring will only scan the classes below your main class package.

com
   +- APP
         +- Application.java  <--- your main class should be here, above your controller classes
         |
         +- model
         |   +- user.java
         +- controller
             +- UserController.java

这篇关于此应用程序没有明确的映射/错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆