前言
在MP中有大量的配置,其中有一部分是Mybatis原生的配置,另一部分是MP的配置,详情:https://mybatis.plus/c
onfig/,下面我们对常用的配置做讲解。
一、配置
1.基本配置
1.1 configLocation
MyBatis 配置文件位置,如果您有单独的 MyBatis 配置,请将其路径配置到 configLocation 中。
- Spring Boot:
mybatis-plus:
configuration:
config-location: classpath:mybatis-config.xml
#如果有单独的mybatis配置,就可以将路径配置在ConfigLocation中
- Spring MVC:
<bean id="sqlSessionFactory"
class="com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean">
<property name="configLocation" value="classpath:mybatis-config.xml"/>
</bean>
1.2 mapperLocations
MyBatis Mapper 所对应的