티스토리 뷰

Spring + Mybatis 

@MapperScan의  sqlSessionFactoryRef 속성지정시, Tomcat을 실행시키면 다음과 같은 WARN 메세지가 미친듯이 뜨고 start 된다. 

실행이 안되는건 아니지만, 찝찝한 경고 메세지

2017-03-07 13:18:59.821  WARN 25580 [main] --- org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean:1480 : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IGameManageDao' defined in file [\admin\dao\gamemanage\IGameManageDao.class]: Cannot resolve reference to bean 'adminSqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'pubdbSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2017-03-07 13:18:59.822  WARN 25580 [main] --- org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean:1480 : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IMissionDao' defined in file [\admin\dao\mission\IMissionDao.class]: Cannot resolve reference to bean 'adminSqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'pubdbSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2017-03-07 13:18:59.823 WARN 25580 [main] --- org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean:1480 : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IPreRegistDao' defined in file [\admin\dao\preregist\IPreRegistDao.class]: Cannot resolve reference to bean 'adminSqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'pubdbSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2017-03-07 13:18:59.825 WARN 25580 [main] --- org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean:1480 : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IStatDao' defined in file [\admin\dao\stat\IStatDao.class]: Cannot resolve reference to bean 'adminSqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'pubdbSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2017-03-07 13:18:59.831 WARN 25580 [main] --- org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean:1480 : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IGameManageDao' defined in file [\admin\dao\gamemanage\IGameManageDao.class]: Cannot resolve reference to bean 'adminSqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'pubdbSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2017-03-07 13:18:59.831 WARN 25580 [main] --- org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean:1480 : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IMissionDao' defined in file [\admin\dao\mission\IMissionDao.class]: Cannot resolve reference to bean 'adminSqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'pubdbSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2017-03-07 13:18:59.832 WARN 25580 [main] --- org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean:1480 : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IPreRegistDao' defined in file [\admin\dao\preregist\IPreRegistDao.class]: Cannot resolve reference to bean 'adminSqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'pubdbSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2017-03-07 13:18:59.833 WARN 25580 [main] --- org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean:1480 : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IStatDao' defined in file [\admin\dao\stat\IStatDao.class]: Cannot resolve reference to bean 'adminSqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'pubdbSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2017-03-07 13:18:59.837 WARN 25580 [main] --- org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean:1480 : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IGameManageDao' defined in file [\admin\dao\gamemanage\IGameManageDao.class]: Cannot resolve reference to bean 'adminSqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'pubdbSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2017-03-07 13:18:59.837 WARN 25580 [main] --- org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean:1480 : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IMissionDao' defined in file [\admin\dao\mission\IMissionDao.class]: Cannot resolve reference to bean 'adminSqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'pubdbSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2017-03-07 13:18:59.838 WARN 25580 [main] --- org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean:1480 : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IPreRegistDao' defined in file [\admin\dao\preregist\IPreRegistDao.class]: Cannot resolve reference to bean 'adminSqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'pubdbSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
2017-03-07 13:18:59.839 WARN 25580 [main] --- org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean:1480 : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IStatDao' defined in file [\admin\dao\stat\IStatDao.class]: Cannot resolve reference to bean 'adminSqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'pubdbSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?



내가 적용한 버전

compile("org.mybatis:mybatis:3.2.7")

compile("org.mybatis:mybatis-spring:1.2.2")

spring 4.2.4


SqlSessionFactory Bean 생성 부분

@Configuration
@MapperScan(basePackages = {MybatisConfig.BASE_PACKAGE }, annotationClass = Admin.class, 
			sqlSessionFactoryRef = "adminSqlSessionFactory")
class MybatisPubdbConfig extends MybatisConfig {

	@Bean(name = "adminSqlSessionFactory")
	public SqlSessionFactory adminSqlSessionFactory(@Qualifier("pubdbDataSource") DataSource dataSource)
			throws Exception {
		SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
		configureSqlSessionFactory(sessionFactoryBean, dataSource);
		return sessionFactoryBean.getObject();
	}
	
	@Bean(name = "adminqlSessionTemplate") 
	public SqlSessionTemplate adminSqlSessionTemplate(SqlSessionFactory adminSqlSessionFactory) throws Exception { 
		return new SqlSessionTemplate(adminSqlSessionFactory); 
	}
}



찾아보니 mybatis와 spring의 버전 문제가 될수 있다고 한다. 

Mybatis 버전을 변경하고 다시 빌드를 해보니, 더이상 WARN 메세지가 없어졌다. 

해결!


compile("org.mybatis:mybatis:3.3.0")

compile("org.mybatis:mybatis-spring:1.2.4")

댓글