您的位置:首页 > 移动开发

No MyBatis mapper was found in '' package. Please check your configura, Could not autowire field

2017-08-24 11:25 1716 查看
今天spring boot 加载一直报

No MyBatis mapper was found in '[com.extracme.volvopark.netty]' package. Please check your configuration.

还以为是配置问题,最后解决方案是:注入的时候把接口的实现类注入了,

原: @Autowired
private BrakeService brakeService;

正确:
@Autowired
private IBrakeService brakeService;
ps:IBrakeService .class是接口;BrakeService 是其实现类

2017-08-24 11:15:21.772 INFO 2996 --- [ main] c.extracme.volvopark.netty.ServerStart : Starting ServerStart on DESKTOP-CBAH040 with PID 2996 (D:\java\space\evspring\volvo-tcpserver\target\classes started by alex in D:\java\space\evspring\volvo-tcpserver)
2017-08-24 11:15:21.772 INFO 2996 --- [ main] c.extracme.volvopark.netty.ServerStart : No active profile set, falling back to default profiles: default
2017-08-24 11:15:21.819 INFO 2996 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@421dc8c8: startup date [Thu Aug 24 11:15:21 CST 2017]; root of context hierarchy
2017-08-24 11:15:22.600 INFO 2996 --- [ main] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [spring.xml]
2017-08-24 11:15:22.707 INFO 2996 --- [ main] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [spring-mybatis.xml]
2017-08-24 11:15:22.848 INFO 2996 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'beanNameViewResolver' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
2017-08-24 11:15:22.912 WARN 2996 --- [ main] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com.extracme.volvopark.netty]' package. Please check your configuration.
2017-08-24 11:15:23.373 INFO 2996 --- [ main] o.s.b.f.c.PropertyPlaceholderConfigurer : Loading properties file from class path resource [application.properties]
2017-08-24 11:15:23.483 INFO 2996 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$b37dacf1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-08-24 11:15:23.971 INFO 2996 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8090 (http)
2017-08-24 11:15:23.980 INFO 2996 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2017-08-24 11:15:23.981 INFO 2996 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.32
2017-08-24 11:15:24.059 INFO 2996 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-08-24 11:15:24.059 INFO 2996 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2240 ms
2017-08-24 11:15:24.421 INFO 2996 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-08-24 11:15:24.421 INFO 2996 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'metricFilter' to: [/*]
2017-08-24 11:15:24.421 INFO 2996 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-08-24 11:15:24.421 INFO 2996 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-08-24 11:15:24.421 INFO 2996 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-08-24 11:15:24.421 INFO 2996 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-08-24 11:15:24.421 INFO 2996 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2017-08-24 11:15:24.421 INFO 2996 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*]
2017-08-24 11:15:24.577 INFO 2996 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited
2017-08-24 11:15:24.749 INFO 2996 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'sendEmailExecutor'
2017-08-24 11:15:24.765 WARN 2996 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stakeMsgHandler': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.MsgController com.extracme.volvopark.netty.server.StakeMsgHandler.MsgController; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'msgController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.extracme.volvopark.netty.iservice.IMsgService com.extracme.volvopark.netty.service.MsgController.msgService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'msgService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.BrakeService com.extracme.volvopark.netty.service.MsgService.brakeService; nested exception is java.lang.IllegalArgumentException: Can not set com.extracme.volvopark.netty.service.BrakeService field com.extracme.volvopark.netty.service.MsgService.brakeService to com.sun.proxy.$Proxy62
2017-08-24 11:15:24.765 INFO 2996 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'sendEmailExecutor'
2017-08-24 11:15:24.765 INFO 2996 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed
2017-08-24 11:15:24.765 INFO 2996 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
--- [ main]o.s.boot.SpringApplication : Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stakeMsgHandler': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.MsgController com.extracme.volvopark.netty.server.StakeMsgHandler.MsgController; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'msgController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.extracme.volvopark.netty.iservice.IMsgService com.extracme.volvopark.netty.service.MsgController.msgService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'msgService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.BrakeService com.extracme.volvopark.netty.service.MsgService.brakeService; nested exception is java.lang.IllegalArgumentException: Can not set com.extracme.volvopark.netty.service.BrakeService field com.extracme.volvopark.netty.service.MsgService.brakeService to com.sun.proxy.$Proxy62
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
at com.extracme.volvopark.netty.ServerStart.main(ServerStart.java:17)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.MsgController com.extracme.volvopark.netty.server.StakeMsgHandler.MsgController; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'msgController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.extracme.volvopark.netty.iservice.IMsgService com.extracme.volvopark.netty.service.MsgController.msgService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'msgService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.BrakeService com.extracme.volvopark.netty.service.MsgService.brakeService; nested exception is java.lang.IllegalArgumentException: Can not set com.extracme.volvopark.netty.service.BrakeService field com.extracme.volvopark.netty.service.MsgService.brakeService to com.sun.proxy.$Proxy62
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 17 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'msgController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.extracme.volvopark.netty.iservice.IMsgService com.extracme.volvopark.netty.service.MsgController.msgService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'msgService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.BrakeService com.extracme.volvopark.netty.service.MsgService.brakeService; nested exception is java.lang.IllegalArgumentException: Can not set com.extracme.volvopark.netty.service.BrakeService field com.extracme.volvopark.netty.service.MsgService.brakeService to com.sun.proxy.$Proxy62
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
... 19 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.extracme.volvopark.netty.iservice.IMsgService com.extracme.volvopark.netty.service.MsgController.msgService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'msgService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.BrakeService com.extracme.volvopark.netty.service.MsgService.brakeService; nested exception is java.lang.IllegalArgumentException: Can not set com.extracme.volvopark.netty.service.BrakeService field com.extracme.volvopark.netty.service.MsgService.brakeService to com.sun.proxy.$Proxy62
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 30 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'msgService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.BrakeService com.extracme.volvopark.netty.service.MsgService.brakeService; nested exception is java.lang.IllegalArgumentException: Can not set com.extracme.volvopark.netty.service.BrakeService field com.extracme.volvopark.netty.service.MsgService.brakeService to com.sun.proxy.$Proxy62
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
... 32 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.BrakeService com.extracme.volvopark.netty.service.MsgService.brakeService; nested exception is java.lang.IllegalArgumentException: Can not set com.extracme.volvopark.netty.service.BrakeService field com.extracme.volvopark.netty.service.MsgService.brakeService to com.sun.proxy.$Proxy62
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 43 common frames omitted
Caused by: java.lang.IllegalArgumentException: Can not set com.extracme.volvopark.netty.service.BrakeService field com.extracme.volvopark.netty.service.MsgService.brakeService to com.sun.proxy.$Proxy62
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168)
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
at java.lang.reflect.Field.set(Field.java:741)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:569)
... 45 common frames omitted

2017-08-24 11:15:24.796 INFO 2996 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-2} inited
2017-08-24 11:15:24.812 WARN 2996 --- [ main] o.s.boot.SpringApplication : Error handling failed (Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-mybatis.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [spring-mybatis.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceInitializer': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.autoconfigure.jdbc.DataSourceProperties org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer.properties; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.datasource.CONFIGURATION_PROPERTIES': Initialization of bean failed; nested exception is java.lang.IllegalStateException: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@421dc8c8 has not been refreshed yet)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Could not autowire f
相关文章推荐