2018-06-29 17:05:05.775 WARN 1075 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userPhoneContactMapper' defined in file [/Users/stacktc/Documents/work/gitlab/server/partTimeJob/target/classes/com/fuming/partjob/dao/UserPhoneContactMapper.class]: Cannot resolve reference to bean 'sqlSessionFactoryBean' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactoryBean': Requested bean is currently in creation: Is there an unresolvable circular reference?
日志如上,同一个项目朋友的windows就没问题,我的mac为什么报创建bean有错误,
求解。
建议可以尝试更新maven
spring关于mybatis的配置文件贴一下?
方法一:
使用注解 @ComponentScan(value=”com.common”),其中,com.common为包路径。
方法二:
将启动类Application放在上一级包中。Application启动类必须要保证在包的根目录下。
他的扫描 mapper是放在一个方法里面的 里面用的@configuration了。的确是可以扫到的,而且,在程序中也是可以 有mapper对象注入的,但是就是报错,狠奇怪。
基本可以判定是环境的问题导致,应该是mybatis相关jar包没有正确导入的原因导致。可以删除本地所有jar包,让maven重新下载导入,再看。