IDEA启动Tomcat时控制台报错原因之一,导致Tomcat启动不了:ERROR - Context initialization failed

 Error creating bean with name 'orderItemServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.how2java.tmall.service.ProductService com.how2java.tmall.service.impl.OrderItemServiceImpl.productService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.how2java.tmall.service.ProductService com.how2java.tmall.service.impl.ProductServiceImpl.productService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.how2java.tmall.service.ProductService] 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)}

: Error creating bean with name 'productServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.how2java.tmall.service.ProductService com.how2java.tmall.service.impl.ProductServiceImpl.productService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.how2java.tmall.service.ProductService] 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)}
    找了好久的错误:结果是serviceImpl中某一个class的

@Autowired

ProductService productService

这个在class文件中未被使用,把它删掉就好啦!

IDEA启动Tomcat时控制台报错原因之一,导致Tomcat启动不了:ERROR - Context initialization failed