spring
spring copied to clipboard
SqlSessionDaoSupport create dozens of SqlSessionTemplate instances meaningless
According to the spring #populateBean method injecting properties' order, reorder the #setSqlSessionTemplate and #setSqlSessionFactory methods postion. Currently, #setSqlSessionFactory method be invoked before #setSqlSessionTemplate ,it will create SqlSessionTemplate meaningless, because the #setSqlSessionTemplate will override the instance the #setSqlSessionFactory method created .This #createSqlSessionTemplate method will be invoked dozens of times meaningless. It will create dozens of SqlSessionTemplate instances.
Coverage remained the same at 89.367% when pulling c4d70186fa373bb531a09cda16bbbc454d1cc31a on yywmrz:master into 477a4f5078f2cecb5d50cb964071310d22036c59 on mybatis:master.
it created sqlSessionTemplate instance in the spring container ,the MapperFactorybean still created dozens of SqlSessionTemplate instances meaningless cause of the order setter proterties (setSqlSessionFactory, setSqlSessionTemplate )
@Bean
@ConditionalOnMissingBean
public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) {
ExecutorType executorType = this.properties.getExecutorType();
if (executorType != null) {
return new SqlSessionTemplate(sqlSessionFactory, executorType);
} else {
return new SqlSessionTemplate(sqlSessionFactory);
}
}
closing as this doesn't fix anything, is out of date, and sounds more like an issue.