因默认包扫描问题导致的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路径下。

下面是错误的位置:

下面是正确的位置:

 

 

如果本文对您有所帮助,请扫描下方微信二维码打赏,您的鼓励是我前进最大的鼓励!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值