Spring Boot启动失败 BeanDefinitionStoreException
2018-01-10 17:02
363 查看
初学Spring Boot,启动时失败:
** WARNING ** :Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:/C:/Users/cmc/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.2.5.RELEASE/spring-boot-autoconfigure-1.2.5.RELEASE.jar!/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$JdbcTemplateConfiguration.class];
nested exception is java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$JdbcTemplateConfiguration due to internal class not found. This can happen if you are @ComponentScanning
a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)
CSDN小伙伴提出的解决方案:
“
查了半天终于才stack overflow上看到了解决方案,链接如下:stack
overflow
是因为application.java 文件不能直接放在main/java文件夹下,必须要建一个包把他放进去
”
官方文档有一小段说明:
When a class does not include a
it is considered to be in the “default package”. The use of the “default package” is generally discouraged and should be avoided. It can cause particular problems for Spring Boot applications that use the
or
since every class from every jar is read.
记录一下学习中遇到的问题踩过的坑
** WARNING ** :Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:/C:/Users/cmc/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.2.5.RELEASE/spring-boot-autoconfigure-1.2.5.RELEASE.jar!/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$JdbcTemplateConfiguration.class];
nested exception is java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$JdbcTemplateConfiguration due to internal class not found. This can happen if you are @ComponentScanning
a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)
CSDN小伙伴提出的解决方案:
“
查了半天终于才stack overflow上看到了解决方案,链接如下:stack
overflow
是因为application.java 文件不能直接放在main/java文件夹下,必须要建一个包把他放进去
”
官方文档有一小段说明:
14.1 Using the “default” Package
When a class does not include a packagedeclaration,
it is considered to be in the “default package”. The use of the “default package” is generally discouraged and should be avoided. It can cause particular problems for Spring Boot applications that use the
@ComponentScan,
@EntityScan,
or
@SpringBootApplicationannotations,
since every class from every jar is read.
记录一下学习中遇到的问题踩过的坑
相关文章推荐
- spring3.0.5启动报错:org.springframework.beans.factory.BeanDefinitionStoreException
- org.springframework.beans.factory.BeanDefinitionStoreException
- org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML doc
- org.springframework.beans.factory.BeanDefinitionStoreException异常处理
- org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document fro
- Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException
- spring-org.springframework.beans.factory.BeanDefinitionStoreException及相关介绍
- org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [/Users/lonecloud/tomcat/apache-tomcat-7.0.70 2/webapps/myproject/WEB-INF/classes/cn/lone
- tomcat启动报org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration pro
- org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML doc
- org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document fro
- org.springframework.beans.factory.BeanDefinitionStoreException: Could not resolve bean definition re
- SpringMVC 问题 org.springframework.beans.factory.BeanDefinitionStoreException
- org.springframework.beans.factory.BeanDefinitionStoreException错误
- org.springframework.beans.factory.BeanDefinitionStoreException 与at org.springframework.asm.ClassRead
- (crm-bug)org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected e
- Spring异常之BeanDefinitionStoreException
- org.springframework.beans.factory.BeanDefinitionStoreException:
- org.springframework.beans.factory.BeanDefinitionStoreException:
- org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML doc