MyBatis-Spring-Boot-Starter,有助于快速构建基于MyBatis的Spring Boot应用。
MyBatis自动配置类MybatisAutoConfiguration
自动发现DataSource
创建并注册一个SqlSessionFactory
实例
创建并注册一个SqlSessionTemplate
实例
自动扫描@Mapper注解的接口为Mapper,可以通过@MapperScan自定义扫描
1 |
|
1 |
|
1 |
|
配置
对应配置类:MybatisProperties
,mybatis前缀
Property | Description |
---|---|
config-location |
Location of MyBatis xml config file. |
check-config-location |
Indicates whether perform presence check of the MyBatis xml config file. |
mapper-locations |
Locations of Mapper xml config file.【支持通配符】 |
type-aliases-package |
Packages to search for type aliases. (Package delimiters are “,; \t\n ”) |
type-handlers-package |
Packages to search for type handlers. (Package delimiters are “,; \t\n ”) |
executor-type |
Executor type: SIMPLE , REUSE , BATCH . |
configuration-properties |
Externalized properties for MyBatis configuration. Specified properties can be used as placeholder on MyBatis config file and Mapper file. For detail see the MyBatis reference page |
configuration |
A MyBatis Configuration bean. About available properties see the MyBatis reference page. NOTE This property cannot be used at the same time with the config-location . |
mybatis.configuration与mybatis.config-location不能同时使用
7个非mybatis.configuration属性
49个mybatis.configuration属性
1 |
|
ConfigurationCustomizer
1 |
|