[Java] 纯文本查看 复制代码
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mapperLocations">
<array>
<value>classpath:mapper/*.xml</value>
</array>
</property>
<property name="typeAliasesPackage" value="com.dmsd.itoo.video.entity"/>
<property name="plugins">
<array>
<-- 主要看这里 -->
<bean class="com.isea533.mybatis.mapperhelper.MapperInterceptor"/>
</array>
</property>
</bean>
[Java] 纯文本查看 复制代码
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mapperLocations" value="classpath:mapper/*.xml" />
<property name="typeAliasesPackage" value="com.dmsd.itoo.video.entity" />
<!-- mybatis全局配置文件 -->
<property name="configLocation" value="classpath:spring/mybatis-config.xml" />
</bean>
mybatis-config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<plugins>
<!-- 通用Maper -->
<plugin interceptor="com.github.abel533.mapperhelper.MapperInterceptor">
<!-- 主键自增回写方法,默认值MYSQL,详细说明请看文档 -->
<property name="IDENTITY" value="MYSQL" />
<!-- 通用Mapper接口,多个通用接口用逗号隔开 -->
<property name="mappers" value="com.github.abel533.mapper.Mapper" />
</plugin>
</plugins>
</configuration>
[Java] 纯文本查看 复制代码
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mapperLocations" value="classpath:mapper/*.xml" />
<property name="typeAliasesPackage" value="com.dmsd.itoo.video.entity" />
<property name="plugins">
<array>
<bean class="com.github.abel533.mapperhelper.MapperInterceptor">
<property name="properties">
<value>
mappers=com.github.abel533.mapper.Mapper
IDENTITY=MYSQL
notEmpty=true
</value>
</property>
</bean>
</array>
</property>
<!-- mybatis全局配置文件 -->
<!-- <property name="configLocation" value="classpath:spring/mybatis-config.xml"></property> -->
</bean>