Closed leimbag closed 8 years ago
包含两个吗?我测试过两个没问题。。
包含2个,我是在原基础上增加了一个实体类,一个mapper和一个mapper.xml文件,就会出现上述问题,增加方式有不一样的地方吗?或者是否能提供该项目为多个mapper的情况
我会增加多个mapper.
期待您的多mapper模式
我在项目中又新增了2个表和对应的实体、Mapper,你可以下载最新代码试试这个问题。
赞,赶紧更新做了尝试,发现问题依旧,启动后会出现WARN,并且每个mapper重复3遍。
本次完全重新pull,仅修改了数据库连接地址和端口,感觉问题很诡异,附加本次相关的环境信息及日志,希望有所帮助。pom文件没有动过。另求一下您的编译环境。感觉这个问题很诡异,使用IDEA和mvn编译结果都一样。相关信息如下:
mac os X Yosemite 版本 10.10.1(14B25)
编译环境: Information:Using javac 1.8.0_20 to compile java sources Information:Module "mybatis-spring-boot (1) (tk.mybatis)" was fully rebuilt due to project configuration/dependencies changes Information:16/1/31 下午11:04 - Compilation completed successfully in 6s 345ms
java -version java version "1.8.0_20" Java(TM) SE Runtime Environment (build 1.8.0_20-b26) Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
mvn -version Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00) Maven home: /usr/share/maven Java version: 1.8.0_20, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/jre Default locale: zh_CN, platform encoding: UTF-8 OS name: "mac os x", version: "10.10.1", arch: "x86_64", family: "mac"
以下是日志信息:
:: Spring Boot :: (v1.3.0.RELEASE)
2016-01-31 23:05:00.842 INFO 71587 --- [ main] tk.mybatis.springboot.Application : Starting Application on localhost with PID 71587 (/Users/leiming/IdeaProjects/spdemo/abel533/MyBatis-Spring-Boot/target/classes started by leiming in /Users/leiming/IdeaProjects/spdemo)
2016-01-31 23:05:00.851 DEBUG 71587 --- [ main] tk.mybatis.springboot.Application : Running with Spring Boot v1.3.0.RELEASE, Spring v4.2.3.RELEASE
2016-01-31 23:05:00.852 INFO 71587 --- [ main] tk.mybatis.springboot.Application : No profiles are active
2016-01-31 23:05:01.106 INFO 71587 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@404bbcbd: startup date [Sun Jan 31 23:05:01 CST 2016]; root of context hierarchy
2016-01-31 23:05:04.156 WARN 71587 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'countryMapper' defined in file [ /IdeaProjects/spdemo/abel533/MyBatis-Spring-Boot/target/classes/tk/mybatis/springboot/mapper/CountryMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2016-01-31 23:05:04.158 WARN 71587 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userInfoMapper' defined in file [ /IdeaProjects/spdemo/abel533/MyBatis-Spring-Boot/target/classes/tk/mybatis/springboot/mapper/UserInfoMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2016-01-31 23:05:04.166 WARN 71587 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'countryMapper' defined in file [ /IdeaProjects/spdemo/abel533/MyBatis-Spring-Boot/target/classes/tk/mybatis/springboot/mapper/CountryMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2016-01-31 23:05:04.167 WARN 71587 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userInfoMapper' defined in file [ /IdeaProjects/spdemo/abel533/MyBatis-Spring-Boot/target/classes/tk/mybatis/springboot/mapper/UserInfoMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2016-01-31 23:05:04.188 WARN 71587 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'countryMapper' defined in file [ /IdeaProjects/spdemo/abel533/MyBatis-Spring-Boot/target/classes/tk/mybatis/springboot/mapper/CountryMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2016-01-31 23:05:04.189 WARN 71587 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userInfoMapper' defined in file [ /IdeaProjects/spdemo/abel533/MyBatis-Spring-Boot/target/classes/tk/mybatis/springboot/mapper/UserInfoMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2016-01-31 23:05:04.409 INFO 71587 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.datasource.CONFIGURATION_PROPERTIES' of type [class org.springframework.boot.autoconfigure.jdbc.DataSourceProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-31 23:05:04.411 INFO 71587 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$NonEmbeddedConfiguration' of type [class org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$NonEmbeddedConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-31 23:05:04.912 INFO 71587 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'dataSource' of type [class com.alibaba.druid.pool.DruidDataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-31 23:05:04.915 INFO 71587 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'myBatisConfig' of type [class tk.mybatis.springboot.conf.MyBatisConfig$$EnhancerBySpringCGLIB$$d6934dc6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-31 23:05:05.651 INFO 71587 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'sqlSessionFactory' of type [class org.apache.ibatis.session.defaults.DefaultSqlSessionFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-31 23:05:05.973 INFO 71587 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'cityMapper' of type [class tk.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-31 23:05:06.080 INFO 71587 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'countryMapper' of type [class tk.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-31 23:05:06.180 INFO 71587 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'userInfoMapper' of type [class tk.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-31 23:05:06.407 INFO 71587 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'annotationDrivenTransactionManager' of type [class org.springframework.jdbc.datasource.DataSourceTransactionManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-31 23:05:06.415 INFO 71587 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$9e0aead9] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-31 23:05:07.020 INFO 71587 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8082 (http)
2016-01-31 23:05:07.088 INFO 71587 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-01-31 23:05:07.090 INFO 71587 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.28
2016-01-31 23:05:07.317 INFO 71587 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-01-31 23:05:07.318 INFO 71587 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 6223 ms
2016-01-31 23:05:07.568 INFO 71587 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-01-31 23:05:07.605 INFO 71587 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-01-31 23:05:08.278 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto java.lang.String tk.mybatis.springboot.Application.home()
2016-01-31 23:05:08.283 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/cities/add]}" onto public tk.mybatis.springboot.model.City tk.mybatis.springboot.controller.CityController.add()
2016-01-31 23:05:08.284 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/cities/delete/{id}]}" onto public org.springframework.ui.ModelMap tk.mybatis.springboot.controller.CityController.delete(java.lang.Integer)
2016-01-31 23:05:08.284 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/cities/save],methods=[POST]}" onto public org.springframework.ui.ModelMap tk.mybatis.springboot.controller.CityController.save(tk.mybatis.springboot.model.City)
2016-01-31 23:05:08.284 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/cities/view/{id}]}" onto public tk.mybatis.springboot.model.City tk.mybatis.springboot.controller.CityController.view(java.lang.Integer)
2016-01-31 23:05:08.284 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/cities]}" onto public com.github.pagehelper.PageInfo<tk.mybatis.springboot.model.City> tk.mybatis.springboot.controller.CityController.getAll(tk.mybatis.springboot.model.City)
2016-01-31 23:05:08.291 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/countries/add]}" onto public org.springframework.web.servlet.ModelAndView tk.mybatis.springboot.controller.CountryController.add()
2016-01-31 23:05:08.291 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/countries/delete/{id}]}" onto public org.springframework.web.servlet.ModelAndView tk.mybatis.springboot.controller.CountryController.delete(java.lang.Integer,org.springframework.web.servlet.mvc.support.RedirectAttributes)
2016-01-31 23:05:08.292 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/countries/save],methods=[POST]}" onto public org.springframework.web.servlet.ModelAndView tk.mybatis.springboot.controller.CountryController.save(tk.mybatis.springboot.model.Country)
2016-01-31 23:05:08.292 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/countries/view/{id}]}" onto public org.springframework.web.servlet.ModelAndView tk.mybatis.springboot.controller.CountryController.view(java.lang.Integer)
2016-01-31 23:05:08.292 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/countries]}" onto public org.springframework.web.servlet.ModelAndView tk.mybatis.springboot.controller.CountryController.getAll(tk.mybatis.springboot.model.Country)
2016-01-31 23:05:08.294 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/add]}" onto public tk.mybatis.springboot.model.UserInfo tk.mybatis.springboot.controller.UserInfoController.add()
2016-01-31 23:05:08.295 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/delete/{id}]}" onto public org.springframework.ui.ModelMap tk.mybatis.springboot.controller.UserInfoController.delete(java.lang.Integer)
2016-01-31 23:05:08.295 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/save],methods=[POST]}" onto public org.springframework.ui.ModelMap tk.mybatis.springboot.controller.UserInfoController.save(tk.mybatis.springboot.model.UserInfo)
2016-01-31 23:05:08.295 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/view/{id}]}" onto public tk.mybatis.springboot.model.UserInfo tk.mybatis.springboot.controller.UserInfoController.view(java.lang.Integer)
2016-01-31 23:05:08.296 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users]}" onto public com.github.pagehelper.PageInfo<tk.mybatis.springboot.model.UserInfo> tk.mybatis.springboot.controller.UserInfoController.getAll(tk.mybatis.springboot.model.UserInfo)
2016-01-31 23:05:08.305 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2016-01-31 23:05:08.306 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
2016-01-31 23:05:08.368 INFO 71587 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/static/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-01-31 23:05:08.455 INFO 71587 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@404bbcbd: startup date [Sun Jan 31 23:05:01 CST 2016]; root of context hierarchy
2016-01-31 23:05:09.594 INFO 71587 --- [ main] o.s.w.s.v.f.FreeMarkerConfigurer : ClassTemplateLoader for Spring macros added to FreeMarker configuration
2016-01-31 23:05:10.037 INFO 71587 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-01-31 23:05:10.040 INFO 71587 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'dataSource' has been autodetected for JMX exposure
2016-01-31 23:05:10.051 INFO 71587 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located MBean 'dataSource': registering with JMX server as MBean [com.alibaba.druid.pool:name=dataSource,type=DruidDataSource]
2016-01-31 23:05:10.208 INFO 71587 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8082 (http)
2016-01-31 23:05:10.217 INFO 71587 --- [ main] tk.mybatis.springboot.Application : Started Application in 10.919 seconds (JVM running for 12.521)
我发个我这里的日志,也有警告:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.3.0.RELEASE)
2016-02-01 22:09:34.389 INFO 208 --- [ main] tk.mybatis.springboot.Application : Starting Application on liuzh-PC with PID 208 (F:\Liu\Git\MyBatis\MyBatis-Spring-Boot\target\classes started by liuzh_3nofxnp in F:\Liu\IDEA\MyBatis)
2016-02-01 22:09:34.391 DEBUG 208 --- [ main] tk.mybatis.springboot.Application : Running with Spring Boot v1.3.0.RELEASE, Spring v4.2.3.RELEASE
2016-02-01 22:09:34.391 INFO 208 --- [ main] tk.mybatis.springboot.Application : No profiles are active
2016-02-01 22:09:34.446 INFO 208 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@15b204a1: startup date [Mon Feb 01 22:09:34 CST 2016]; root of context hierarchy
2016-02-01 22:09:35.783 WARN 208 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'countryMapper' defined in file [F:\Liu\Git\MyBatis\MyBatis-Spring-Boot\target\classes\tk\mybatis\springboot\mapper\CountryMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2016-02-01 22:09:35.784 WARN 208 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userInfoMapper' defined in file [F:\Liu\Git\MyBatis\MyBatis-Spring-Boot\target\classes\tk\mybatis\springboot\mapper\UserInfoMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2016-02-01 22:09:35.786 WARN 208 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'countryMapper' defined in file [F:\Liu\Git\MyBatis\MyBatis-Spring-Boot\target\classes\tk\mybatis\springboot\mapper\CountryMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2016-02-01 22:09:35.787 WARN 208 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userInfoMapper' defined in file [F:\Liu\Git\MyBatis\MyBatis-Spring-Boot\target\classes\tk\mybatis\springboot\mapper\UserInfoMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2016-02-01 22:09:35.792 WARN 208 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'countryMapper' defined in file [F:\Liu\Git\MyBatis\MyBatis-Spring-Boot\target\classes\tk\mybatis\springboot\mapper\CountryMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2016-02-01 22:09:35.793 WARN 208 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userInfoMapper' defined in file [F:\Liu\Git\MyBatis\MyBatis-Spring-Boot\target\classes\tk\mybatis\springboot\mapper\UserInfoMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2016-02-01 22:09:35.894 INFO 208 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.datasource.CONFIGURATION_PROPERTIES' of type [class org.springframework.boot.autoconfigure.jdbc.DataSourceProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-02-01 22:09:35.895 INFO 208 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$NonEmbeddedConfiguration' of type [class org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$NonEmbeddedConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-02-01 22:09:36.139 INFO 208 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'dataSource' of type [class com.alibaba.druid.pool.DruidDataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-02-01 22:09:36.141 INFO 208 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'myBatisConfig' of type [class tk.mybatis.springboot.conf.MyBatisConfig$$EnhancerBySpringCGLIB$$ee5723cb] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-02-01 22:09:36.445 INFO 208 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'sqlSessionFactory' of type [class org.apache.ibatis.session.defaults.DefaultSqlSessionFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-02-01 22:09:36.561 INFO 208 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'cityMapper' of type [class tk.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-02-01 22:09:36.603 INFO 208 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'countryMapper' of type [class tk.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-02-01 22:09:36.640 INFO 208 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'userInfoMapper' of type [class tk.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-02-01 22:09:36.662 INFO 208 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'annotationDrivenTransactionManager' of type [class org.springframework.jdbc.datasource.DataSourceTransactionManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-02-01 22:09:36.663 INFO 208 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$b5cec0de] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-02-01 22:09:37.055 INFO 208 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-02-01 22:09:37.065 INFO 208 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-02-01 22:09:37.067 INFO 208 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.28
2016-02-01 22:09:37.176 INFO 208 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-02-01 22:09:37.176 INFO 208 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2733 ms
2016-02-01 22:09:37.295 INFO 208 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-02-01 22:09:37.300 INFO 208 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-02-01 22:09:37.541 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto java.lang.String tk.mybatis.springboot.Application.home()
2016-02-01 22:09:37.544 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/cities/add]}" onto public tk.mybatis.springboot.model.City tk.mybatis.springboot.controller.CityController.add()
2016-02-01 22:09:37.544 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/cities/delete/{id}]}" onto public org.springframework.ui.ModelMap tk.mybatis.springboot.controller.CityController.delete(java.lang.Integer)
2016-02-01 22:09:37.544 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/cities/save],methods=[POST]}" onto public org.springframework.ui.ModelMap tk.mybatis.springboot.controller.CityController.save(tk.mybatis.springboot.model.City)
2016-02-01 22:09:37.544 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/cities/view/{id}]}" onto public tk.mybatis.springboot.model.City tk.mybatis.springboot.controller.CityController.view(java.lang.Integer)
2016-02-01 22:09:37.545 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/cities]}" onto public com.github.pagehelper.PageInfo<tk.mybatis.springboot.model.City> tk.mybatis.springboot.controller.CityController.getAll(tk.mybatis.springboot.model.City)
2016-02-01 22:09:37.547 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/countries/add]}" onto public org.springframework.web.servlet.ModelAndView tk.mybatis.springboot.controller.CountryController.add()
2016-02-01 22:09:37.547 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/countries/delete/{id}]}" onto public org.springframework.web.servlet.ModelAndView tk.mybatis.springboot.controller.CountryController.delete(java.lang.Integer,org.springframework.web.servlet.mvc.support.RedirectAttributes)
2016-02-01 22:09:37.547 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/countries/save],methods=[POST]}" onto public org.springframework.web.servlet.ModelAndView tk.mybatis.springboot.controller.CountryController.save(tk.mybatis.springboot.model.Country)
2016-02-01 22:09:37.548 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/countries/view/{id}]}" onto public org.springframework.web.servlet.ModelAndView tk.mybatis.springboot.controller.CountryController.view(java.lang.Integer)
2016-02-01 22:09:37.548 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/countries]}" onto public org.springframework.web.servlet.ModelAndView tk.mybatis.springboot.controller.CountryController.getAll(tk.mybatis.springboot.model.Country)
2016-02-01 22:09:37.549 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/add]}" onto public tk.mybatis.springboot.model.UserInfo tk.mybatis.springboot.controller.UserInfoController.add()
2016-02-01 22:09:37.549 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/delete/{id}]}" onto public org.springframework.ui.ModelMap tk.mybatis.springboot.controller.UserInfoController.delete(java.lang.Integer)
2016-02-01 22:09:37.549 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/save],methods=[POST]}" onto public org.springframework.ui.ModelMap tk.mybatis.springboot.controller.UserInfoController.save(tk.mybatis.springboot.model.UserInfo)
2016-02-01 22:09:37.549 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/view/{id}]}" onto public tk.mybatis.springboot.model.UserInfo tk.mybatis.springboot.controller.UserInfoController.view(java.lang.Integer)
2016-02-01 22:09:37.549 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users]}" onto public com.github.pagehelper.PageInfo<tk.mybatis.springboot.model.UserInfo> tk.mybatis.springboot.controller.UserInfoController.getAll(tk.mybatis.springboot.model.UserInfo)
2016-02-01 22:09:37.556 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2016-02-01 22:09:37.557 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
2016-02-01 22:09:37.627 INFO 208 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@15b204a1: startup date [Mon Feb 01 22:09:34 CST 2016]; root of context hierarchy
2016-02-01 22:09:37.685 INFO 208 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/static/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-02-01 22:09:38.143 INFO 208 --- [ main] o.s.w.s.v.f.FreeMarkerConfigurer : ClassTemplateLoader for Spring macros added to FreeMarker configuration
2016-02-01 22:09:38.231 INFO 208 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-02-01 22:09:38.233 INFO 208 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'dataSource' has been autodetected for JMX exposure
2016-02-01 22:09:38.236 INFO 208 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located MBean 'dataSource': registering with JMX server as MBean [com.alibaba.druid.pool:name=dataSource,type=DruidDataSource]
2016-02-01 22:09:38.317 INFO 208 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2016-02-01 22:09:38.321 INFO 208 --- [ main] tk.mybatis.springboot.Application : Started Application in 4.36 seconds (JVM running for 5.725)
原来同有,我一开始想解决这个WARN,跟踪spring代码跟的晕了,对于会重复加载固定的3遍比较困惑,跟踪发现主要是在sqlSessionFactory加载时报错。不过在换为官方的spring-mybatis时,却没有该警告,不知道是不是和tk包里的MapperScannerConfigurer实现有关系。
我找时间和mybatis-starter对比看看。
这个bug是mybatis-spring的,换到最新的1.2.4版本就没问题了。
赞,已更新1.2.4尝试,并且需将通用mapper升级为3.3.6后,启动无warn。
today, i meet the same problem ,but when i try
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.1</version>
this problem gone away, i guess this bug is belong to mybatis-spring
hi,abel533,我下载了本demo项目,在使用单个mapper时没有报这个警告错误,但是当把mapper增加为2个以上时,就会报该异常信息,不知具体的原因。
跟踪代码,看到会优先执行MyBatisMapperScannerConfig扫描,虽然设置了AutoConfigureAfter,MyBatisMapperScannerConfig修改definition.setBeanClass(MapperFactoryBean.class)后,spring在做dataSourceInitializerPostProcessor处理时,会抛出该异常,不知道哪里出了问题。而且会重复出现2,3边同样的WARN,百分百重现。
WARN 43180 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'subCountryMapper' defined in file [/tt/fsm/target/classes/com/lmtest/fsm/mapper/SubCountryMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?