Class MybatisAutoConfiguration

java.lang.Object
org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean

@Configuration(proxyBeanMethods=false) @ConditionalOnClass({org.apache.ibatis.session.SqlSessionFactory.class,org.mybatis.spring.SqlSessionFactoryBean.class}) @ConditionalOnSingleCandidate(javax.sql.DataSource.class) @EnableConfigurationProperties(MybatisProperties.class) @AutoConfigureAfter({org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration.class,MybatisLanguageDriverAutoConfiguration.class}) public class MybatisAutoConfiguration extends Object implements org.springframework.beans.factory.InitializingBean
Auto-Configuration for Mybatis. Contributes a SqlSessionFactory and a SqlSessionTemplate. If MapperScan is used, or a configuration file is specified as a property, those will be considered, otherwise this auto-configuration will attempt to register mappers based on the interface definitions in or under the root auto-configuration package.
Author:
Eddú Meléndez, Josh Long, Kazuki Shimizu, Eduardo Macarrón
  • Constructor Details

    • MybatisAutoConfiguration

      public MybatisAutoConfiguration(MybatisProperties properties, org.springframework.beans.factory.ObjectProvider<org.apache.ibatis.plugin.Interceptor[]> interceptorsProvider, org.springframework.beans.factory.ObjectProvider<org.apache.ibatis.type.TypeHandler[]> typeHandlersProvider, org.springframework.beans.factory.ObjectProvider<org.apache.ibatis.scripting.LanguageDriver[]> languageDriversProvider, org.springframework.core.io.ResourceLoader resourceLoader, org.springframework.beans.factory.ObjectProvider<org.apache.ibatis.mapping.DatabaseIdProvider> databaseIdProvider, org.springframework.beans.factory.ObjectProvider<List<ConfigurationCustomizer>> configurationCustomizersProvider, org.springframework.beans.factory.ObjectProvider<List<SqlSessionFactoryBeanCustomizer>> sqlSessionFactoryBeanCustomizers)
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • sqlSessionFactory

      @Bean @ConditionalOnMissingBean public org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
      Throws:
      Exception
    • sqlSessionTemplate

      @Bean @ConditionalOnMissingBean public org.mybatis.spring.SqlSessionTemplate sqlSessionTemplate(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)