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會自動加載啟動類所在包下及其子包下的所有組件.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM