mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
feat: optimize FlexSqlSessionFactoryBean.java
This commit is contained in:
parent
1902324018
commit
c3cd2d2b93
@ -42,7 +42,6 @@ import org.mybatis.spring.SqlSessionFactoryBean;
|
|||||||
import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
|
import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
|
||||||
import org.springframework.beans.factory.FactoryBean;
|
import org.springframework.beans.factory.FactoryBean;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.context.ApplicationEvent;
|
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.context.event.ContextRefreshedEvent;
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
@ -91,7 +90,7 @@ import static org.springframework.util.StringUtils.tokenizeToStringArray;
|
|||||||
* @author life
|
* @author life
|
||||||
*/
|
*/
|
||||||
public class FlexSqlSessionFactoryBean extends SqlSessionFactoryBean
|
public class FlexSqlSessionFactoryBean extends SqlSessionFactoryBean
|
||||||
implements FactoryBean<SqlSessionFactory>, InitializingBean, ApplicationListener<ApplicationEvent> {
|
implements FactoryBean<SqlSessionFactory>, InitializingBean, ApplicationListener<ContextRefreshedEvent> {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(SqlSessionFactoryBean.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(SqlSessionFactoryBean.class);
|
||||||
|
|
||||||
@ -669,8 +668,8 @@ public class FlexSqlSessionFactoryBean extends SqlSessionFactoryBean
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onApplicationEvent(ApplicationEvent event) {
|
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||||
if (failFast && event instanceof ContextRefreshedEvent) {
|
if (failFast) {
|
||||||
// fail-fast -> check all statements are completed
|
// fail-fast -> check all statements are completed
|
||||||
this.sqlSessionFactory.getConfiguration().getMappedStatementNames();
|
this.sqlSessionFactory.getConfiguration().getMappedStatementNames();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user