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

相关文章:

  • 2022-12-23
  • 2021-07-09
  • 2021-04-25
  • 2021-11-02
  • 2022-12-23
  • 2021-08-06
  • 2021-06-19
  • 2021-11-08
猜你喜欢
  • 2021-10-24
  • 2022-12-23
  • 2021-05-07
  • 2021-08-05
  • 2022-12-23
  • 2021-05-29
相关资源
相似解决方案