1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
- <beans xmlns =" http://www.springframework.org/schema/beans"
3
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
2
+ <beans xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
3
xmlns : jdbc =" http://www.springframework.org/schema/jdbc"
5
4
xmlns : tx =" http://www.springframework.org/schema/tx"
6
5
xmlns : aop =" http://www.springframework.org/schema/aop"
7
6
xmlns : context =" http://www.springframework.org/schema/context"
7
+ xmlns =" http://www.springframework.org/schema/beans"
8
8
xsi : schemaLocation =" http://www.springframework.org/schema/beans
9
9
http://www.springframework.org/schema/beans/spring-beans.xsd
10
10
http://www.springframework.org/schema/jdbc
16
16
http://www.springframework.org/schema/context
17
17
http://www.springframework.org/schema/context/spring-context.xsd" >
18
18
19
- <context : component-scan base-package =" com.isea533.mybatis.service" />
19
+ <context : component-scan base-package =" com.isea533.mybatis.service" />
20
20
21
- <!-- hsqldb测试数据库-->
22
- <jdbc : embedded-database id =" dataSource" >
23
- <jdbc : script location =" classpath:hsqldb.sql" />
24
- </jdbc : embedded-database >
21
+ <!-- hsqldb测试数据库-->
22
+ <jdbc : embedded-database id =" dataSource" >
23
+ <jdbc : script location =" classpath:hsqldb.sql" />
24
+ </jdbc : embedded-database >
25
25
26
- <bean id =" sqlSessionFactory" class =" org.mybatis.spring.SqlSessionFactoryBean" >
27
- <property name =" dataSource" ref =" dataSource" />
28
- <property name =" mapperLocations" >
29
- <array >
30
- <value >classpath:mapper/*.xml</value >
31
- <value >classpath:com/isea533/mybatis/mapper/*.xml</value >
32
- </array >
33
- </property >
34
- <property name =" typeAliasesPackage" value =" com.isea533.mybatis.model" />
35
- <property name =" plugins" >
36
- <array >
37
- <bean class =" com.github.pagehelper.PageHelper" >
38
- <property name =" properties" >
39
- <value >
40
- dialect=hsqldb
41
- reasonable=true
42
- </value >
43
- </property >
44
- </bean >
45
- <bean class =" tk.mybatis.mapper.mapperhelper.MapperInterceptor" >
46
- <property name =" properties" >
26
+ <bean id =" sqlSessionFactory" class =" org.mybatis.spring.SqlSessionFactoryBean" >
27
+ <property name =" dataSource" ref =" dataSource" />
28
+ <property name =" mapperLocations" >
29
+ <array >
30
+ <value >classpath:mapper/*.xml</value >
31
+ <value >classpath:com/isea533/mybatis/mapper/*.xml</value >
32
+ </array >
33
+ </property >
34
+ <property name =" typeAliasesPackage" value =" com.isea533.mybatis.model" />
35
+ <property name =" plugins" >
36
+ <array >
37
+ <bean class =" com.github.pagehelper.PageHelper" >
38
+ <property name =" properties" >
39
+ <value >
40
+ dialect=hsqldb
41
+ reasonable=true
42
+ </value >
43
+ </property >
44
+ </bean >
45
+ </array >
46
+ </property >
47
+ </bean >
48
+
49
+ <bean class =" tk.mybatis.spring.mapper.MapperScannerConfigurer" >
50
+ <property name =" basePackage" value =" com.isea533.mybatis.mapper" />
51
+ <!-- 通用Mapper通过属性注入进行配置,默认不配置时会注册Mapper<T>接口
52
+ <property name="properties">
47
53
<value>
48
54
mappers=tk.mybatis.mapper.common.Mapper
49
- IDENTITY=MYSQL
50
- notEmpty=true
51
55
</value>
52
- </property >
53
- </bean >
54
- </array >
55
- </property >
56
- </bean >
57
-
58
- <bean class =" org.mybatis.spring.mapper.MapperScannerConfigurer" >
59
- <property name =" basePackage" value =" com.isea533.mybatis.mapper" />
60
- </bean >
56
+ </property>
57
+ -->
58
+ </bean >
61
59
62
- <bean id =" sqlSession" class =" org.mybatis.spring.SqlSessionTemplate" scope =" prototype" >
63
- <constructor-arg index =" 0" ref =" sqlSessionFactory" />
64
- </bean >
60
+ <bean id =" sqlSession" class =" org.mybatis.spring.SqlSessionTemplate" scope =" prototype" >
61
+ <constructor-arg index =" 0" ref =" sqlSessionFactory" />
62
+ </bean >
65
63
66
- <aop : aspectj-autoproxy />
64
+ <aop : aspectj-autoproxy />
67
65
68
- <aop : config >
69
- <aop : pointcut id =" appService" expression =" execution(* com.isea533.mybatis.service.*.*Service*(..))" />
70
- <aop : advisor advice-ref =" txAdvice" pointcut-ref =" appService" />
71
- </aop : config >
66
+ <aop : config >
67
+ <aop : pointcut id =" appService" expression =" execution(* com.isea533.mybatis.service.*.*Service*(..))" />
68
+ <aop : advisor advice-ref =" txAdvice" pointcut-ref =" appService" />
69
+ </aop : config >
72
70
73
- <tx : advice id =" txAdvice" transaction-manager =" transactionManager" >
74
- <tx : attributes >
75
- <tx : method name =" select*" read-only =" true" />
76
- <tx : method name =" find*" read-only =" true" />
77
- <tx : method name =" get*" read-only =" true" />
78
- <tx : method name =" *" />
79
- </tx : attributes >
80
- </tx : advice >
71
+ <tx : advice id =" txAdvice" transaction-manager =" transactionManager" >
72
+ <tx : attributes >
73
+ <tx : method name =" select*" read-only =" true" />
74
+ <tx : method name =" find*" read-only =" true" />
75
+ <tx : method name =" get*" read-only =" true" />
76
+ <tx : method name =" *" />
77
+ </tx : attributes >
78
+ </tx : advice >
81
79
82
- <bean id =" transactionManager" class =" org.springframework.jdbc.datasource.DataSourceTransactionManager" >
83
- <property name =" dataSource" ref =" dataSource" />
84
- </bean >
80
+ <bean id =" transactionManager" class =" org.springframework.jdbc.datasource.DataSourceTransactionManager" >
81
+ <property name =" dataSource" ref =" dataSource" />
82
+ </bean >
85
83
</beans >
0 commit comments