Skip to content

Commit c6d5727

Browse files
committed
更新到通用Mapper3.1.3,使用mapperhelper配置,为下个版本准备
1 parent d54ed9c commit c6d5727

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<!-- 编译jdk版本 -->
2323
<jdk.version>1.6</jdk.version>
2424
<!-- 依赖版本 -->
25-
<mapper.version>3.1.3-SNAPSHOT</mapper.version>
25+
<mapper.version>3.1.3</mapper.version>
2626
<pagehelper.version>4.0.0</pagehelper.version>
2727
<mysql.version>5.1.29</mysql.version>
2828
<spring.version>4.1.2.RELEASE</spring.version>

src/main/resources/applicationContext.xml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,6 @@
8181
</value>
8282
</property>
8383
</bean>
84-
<bean class="tk.mybatis.mapper.mapperhelper.MapperOnceInterceptor">
85-
<property name="properties">
86-
<value>
87-
mappers=tk.mybatis.mapper.common.Mapper
88-
IDENTITY=MYSQL
89-
notEmpty=true
90-
</value>
91-
</property>
92-
</bean>
9384
</array>
9485
</property>
9586
</bean>
@@ -103,6 +94,16 @@
10394
<constructor-arg index="0" ref="sqlSessionFactory"/>
10495
</bean>
10596

97+
<bean class="tk.mybatis.mapper.mapperhelper.MapperHelper"
98+
init-method="initMapper" scope="singleton" lazy-init="false">
99+
<property name="mappers">
100+
<array>
101+
<value>${mapper.Mapper}</value>
102+
</array>
103+
</property>
104+
<property name="sqlSessions" ref="sqlSession"/>
105+
</bean>
106+
106107
<aop:aspectj-autoproxy/>
107108

108109
<aop:config>

src/main/resources/config.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
# \u6570\u636E\u5E93\u914D\u7F6E
2626
jdbc.driverClass = com.mysql.jdbc.Driver
27-
jdbc.url = jdbc:mysql://192.168.1.200:3306/test
27+
jdbc.url = jdbc:mysql://192.168.16.137:3306/test
2828
jdbc.user = root
2929
jdbc.password =
3030

src/test/java/com/isea533/mybatis/test/PageMapperTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.github.pagehelper.PageInfo;
2929
import com.isea533.mybatis.mapper.CountryMapper;
3030
import com.isea533.mybatis.model.Country;
31+
import org.apache.ibatis.session.SqlSession;
3132
import org.junit.Test;
3233
import org.springframework.beans.factory.annotation.Autowired;
3334
import tk.mybatis.mapper.entity.Example;
@@ -39,11 +40,15 @@
3940
*/
4041
public class PageMapperTest extends BasicTest {
4142

43+
// @Autowired
44+
// private CountryMapper countryMapper;
45+
4246
@Autowired
43-
private CountryMapper countryMapper;
47+
private SqlSession sqlSession;
4448

4549
@Test
4650
public void test(){
51+
CountryMapper countryMapper = sqlSession.getMapper(CountryMapper.class);
4752
Example example = new Example(Country.class);
4853
example.createCriteria().andGreaterThan("id",100);
4954
PageHelper.startPage(2,10);

0 commit comments

Comments
 (0)