因默認包掃描問題導致的SpringBoot項目無法啟動問題


啟動SpringBoot項目的時候,提示如下信息:

2017-08-28 11:26:22.255  INFO 8236 --- [           main] s.c.a.AnnotationConfigApplicationContext : 
Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@4e3958e7:
startup date [Mon Aug 28 11:26:22 CST 2017]; root of context hierarchy 2017-08-28 11:26:22.817 INFO 8236 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor :
JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2017-08-28 11:26:22.864 INFO 8236 --- [ main] trationDelegate$BeanPostProcessorChecker :
Bean 'configurationPropertiesRebinderAutoConfiguration' of type
[class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$105a6ef0]
is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.4.2.RELEASE) 2017-08-28 11:26:23.551 INFO 8236 --- [ main] EurekaServerMasterApplication :
No active profile set, falling back to default profiles: default 2017-08-28 11:26:23.567 INFO 8236 --- [ main] ationConfigEmbeddedWebApplicationContext :
Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@12c7a01b:
startup date [Mon Aug 28 11:26:23 CST 2017];
parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@4e3958e7
2017-08-28 11:26:23.582 WARN 8236 --- [ main] ionWarningsApplicationContextInitializer : ** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.

 

解決辦法:

把main方法所在的類放到一個自定義的包路徑下,而不能直接放在mian/java路徑下。

下面是錯誤的位置:

下面是正確的位置:

 

 

如果本文對您有所幫助,請掃描下方微信二維碼打賞,您的鼓勵是我前進最大的鼓勵!


免責聲明!

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



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