Spring 报错:Error creating bean with name
Posted 归零,路上
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Spring 报错:Error creating bean with name相关的知识,希望对你有一定的参考价值。
java项目编译正常,但在tomcat中发布时,报错,错误信息如下:
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘XXXXX‘: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: XXXXXXX; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [XXXXXX] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1120)
原因是在autowire/resource时,找不到相应的类,上述问题是因为XXXXX的实现类中没有加相应的注解。如dao层 @Repository 如service层 @Service
以上是关于Spring 报错:Error creating bean with name的主要内容,如果未能解决你的问题,请参考以下文章
Spring 报错:Error creating bean with name
spring-boot导入redis依赖后报错 Error creating bean with name ‘redisConnectionFactory‘
Spring Boot 报错:Error creating bean with name 'entityManagerFactory' defined in class path re
Spring 定时器 使用quartz 报错问题 Error creating bean with name 'reportTask' defined in file 求解
Spring Boot报错Error creating bean with name 'userRepository': Invocation of init method faile
spring 管理hibernate事务 配置完了报错 Error creating bean with name 'loginAction' defined in file .