1. Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.ha.service.UserService] found for dependency [com.imut.service.IUserService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
问题:bean自动注入失败了,
解决办法:检查提示的类是否增加了@Service、@Component等注解,以及启动类或配置文件的扫描包路径,是否包含了这个类的路径。
2. [main] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectMapperConfigurer' defined in class path resource [springfox/documentation/spring/web/SpringfoxWebMvcConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.annotation.ProxyCachingConfiguration': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metaDataSourceAdvisor': Cannot resolve reference to bean 'methodSecurityMetadataSource' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error Type referred to is not an annotation type: com$zh$system$annotation$11$Log
问题:出现这个问题的愿意我的项目代码整个结构做了调整,Log类是一个注解类,使用AOP对使用此注解的方法打记录日志。出现这个错的原因就是AOP方法没有找到注解类造成的。这种错误idea或者maven编译时都不会报的。
解决:在@Aspect类里把注解类路径改对就好了。