spring使用过程中遇到的问题

1、出现这样的错误:The type org.springframework.core.NestedRuntimeException cannot be resolved. It is indirectly referenced from required .class files怎样解决啊?!!

org.springframework.core.NestedRuntimeException
在org.springframework.core-3.0.5.RELEASE.jar中,导入就好了

 

2、** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.

因为application.Java 文件不能直接放在main/java文件夹下,必须要建一个包把他放进去

https://stackoverflow.com/documentation

 

3、spring-boot启动时出现

Whitelabel Error Page

 

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Dec 14 16:35:25 CST 2016
There was an unexpected error (type=Not Found, status=404).
No message available

 

很像是没有读到你要访问的地址。

原因是【Application启动类放的位置不对】要将Application放在最外层,也就是要包含所有子包。

比如你的groupId是com.google,子包就是所谓的com.google.xxx,所以要将Application放在com.google包下。

请参考以下结论:spring-boot会自动加载启动类所在包下及其子包下的所有组件.

posted on 2017-07-26 19:11  Michael2397  阅读(2334)  评论(0编辑  收藏  举报

导航