mybatis-spring
public class SqlSessionFactoryBean implements FactoryBean<SqlSessionFactory>, InitializingBean, ApplicationListener<ApplicationEvent> { bean初始化public void afterPropertiesSet() throws Exception { Assert.notNull(this.dataSource, "Property 'dataSource' is required"); Assert.notNull(this.sqlSessionFactoryBuilder, "Property 'sqlSessionFactoryBuilder' is required"); Assert.state(this.configuration == null && this.configLocation == null || this.configuration == null || this.configLocation == null, "Property 'configuration' and 'configLocation' can not specified with together"); this.sqlSessionFactory = this.buildSqlSessionFactory(); }SqlSessionFactoryBuilder
SqlSessionFactory build(Reader reader)
DefaultSqlSessionFactory
public class DefaultSqlSessionFactory implements SqlSessionFactory {
public SqlSession openSession(boolean autoCommit) { return this.openSessionFromDataSource(this.configuration.getDefaultExecutorType(), (TransactionIsolationLevel)null, autoCommit); }
// ..
}
DefaultSqlSession
public class DefaultSqlSession implements SqlSession { select selectList insert update // ... }
spring事件监听
public void onApplicationEvent(ApplicationEvent event) { if (this.failFast && event instanceof ContextRefreshedEvent) { this.sqlSessionFactory.getConfiguration().getMappedStatementNames(); } }
标签:configuration,Property,class,Assert,源码,MyBatis,null,public From: https://www.cnblogs.com/clarino/p/17599011.html