3. 使用配置
MyBatis-Plus在使用过程中的配置选项,其中,部分配置继承自MyBatis原生所支持的配置。这里主要讲解SpringMVC和SpringBoot配置的差异。具体的配置项可以参考官方的文档,[MP的配置] mp.baomidou.com/config/
3.1. 使用方式
- Spring Boot:
mybatis-plus:
......
configuration:
......
global-config:
......
db-config:
......
- Spring MVC:
<bean id="sqlSessionFactory" class="com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean">
<property name="configuration" ref="configuration"/> <!-- 非必须 -->
<property name="globalConfig" ref="globalConfig"/> <!-- 非必须 -->
......
</bean>
<bean id="configuration" class="com.baomidou.mybatisplus.core.MybatisConfiguration">
......
</bean>
<bean id="globalConfig" class="com.baomidou.mybatisplus.core.config.GlobalConfig">
<property name="dbConfig" ref="dbConfig"/> <!-- 非必须 -->
......
</bean>
<bean id="dbConfig" class="com.baomidou.mybatisplus.core.config.GlobalConfig.DbConfig">
......
</bean>
點(diǎn)擊查看更多內(nèi)容
為 TA 點(diǎn)贊
評(píng)論
評(píng)論
共同學(xué)習(xí),寫下你的評(píng)論
評(píng)論加載中...
作者其他優(yōu)質(zhì)文章
正在加載中
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦