23
23
~ THE SOFTWARE.
24
24
-->
25
25
26
- <beans xmlns =" http://www.springframework.org/schema/beans"
27
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
26
+ <beans xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
28
27
xmlns : tx =" http://www.springframework.org/schema/tx"
29
28
xmlns : aop =" http://www.springframework.org/schema/aop"
30
29
xmlns : context =" http://www.springframework.org/schema/context"
30
+ xmlns =" http://www.springframework.org/schema/beans"
31
31
xsi : schemaLocation =" http://www.springframework.org/schema/beans
32
32
http://www.springframework.org/schema/beans/spring-beans.xsd
33
33
http://www.springframework.org/schema/tx
37
37
http://www.springframework.org/schema/context
38
38
http://www.springframework.org/schema/context/spring-context.xsd" >
39
39
40
- <context : component-scan base-package =" com.isea533.mybatis.service" />
40
+ <context : component-scan base-package =" com.isea533.mybatis.service" />
41
41
42
- <context : property-placeholder location =" classpath:config.properties" />
42
+ <context : property-placeholder location =" classpath:config.properties" />
43
43
44
- <bean id =" dataSource" class =" com.alibaba.druid.pool.DruidDataSource" init-method =" init" destroy-method =" close" >
45
- <property name =" driverClassName" value =" ${jdbc.driverClass}" />
46
- <property name =" url" value =" ${jdbc.url}" />
47
- <property name =" username" value =" ${jdbc.user}" />
48
- <property name =" password" value =" ${jdbc.password}" />
44
+ <bean id =" dataSource" class =" com.alibaba.druid.pool.DruidDataSource" init-method =" init" destroy-method =" close" >
45
+ <property name =" driverClassName" value =" ${jdbc.driverClass}" />
46
+ <property name =" url" value =" ${jdbc.url}" />
47
+ <property name =" username" value =" ${jdbc.user}" />
48
+ <property name =" password" value =" ${jdbc.password}" />
49
49
50
- <property name =" filters" value =" stat" />
50
+ <property name =" filters" value =" stat" />
51
51
52
- <property name =" maxActive" value =" 20" />
53
- <property name =" initialSize" value =" 1" />
54
- <property name =" maxWait" value =" 60000" />
55
- <property name =" minIdle" value =" 1" />
52
+ <property name =" maxActive" value =" 20" />
53
+ <property name =" initialSize" value =" 1" />
54
+ <property name =" maxWait" value =" 60000" />
55
+ <property name =" minIdle" value =" 1" />
56
56
57
- <property name =" timeBetweenEvictionRunsMillis" value =" 60000" />
58
- <property name =" minEvictableIdleTimeMillis" value =" 300000" />
57
+ <property name =" timeBetweenEvictionRunsMillis" value =" 60000" />
58
+ <property name =" minEvictableIdleTimeMillis" value =" 300000" />
59
59
60
- <property name =" validationQuery" value =" SELECT 'x'" />
61
- <property name =" testWhileIdle" value =" true" />
62
- <property name =" testOnBorrow" value =" false" />
63
- <property name =" testOnReturn" value =" false" />
64
- </bean >
60
+ <property name =" validationQuery" value =" SELECT 'x'" />
61
+ <property name =" testWhileIdle" value =" true" />
62
+ <property name =" testOnBorrow" value =" false" />
63
+ <property name =" testOnReturn" value =" false" />
64
+ </bean >
65
65
66
- <bean id =" sqlSessionFactory" class =" org.mybatis.spring.SqlSessionFactoryBean" >
67
- <property name =" dataSource" ref =" dataSource" />
68
- <property name =" mapperLocations" >
69
- <array >
70
- <value >classpath:mapper/*.xml</value >
71
- </array >
72
- </property >
73
- <property name =" typeAliasesPackage" value =" com.isea533.mybatis.model" />
74
- <property name =" plugins" >
75
- <array >
76
- <bean class =" com.github.pagehelper.PageHelper" >
77
- <property name =" properties" >
78
- <value >
79
- dialect=mysql
80
- reasonable=true
81
- </value >
82
- </property >
83
- </bean >
84
- <bean class =" tk.mybatis.mapper.mapperhelper.MapperInterceptor " >
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 >
93
- </array >
94
- </property >
95
- </bean >
66
+ <bean id =" sqlSessionFactory" class =" org.mybatis.spring.SqlSessionFactoryBean" >
67
+ <property name =" dataSource" ref =" dataSource" />
68
+ <property name =" mapperLocations" >
69
+ <array >
70
+ <value >classpath:mapper/*.xml</value >
71
+ </array >
72
+ </property >
73
+ <property name =" typeAliasesPackage" value =" com.isea533.mybatis.model" />
74
+ <property name =" plugins" >
75
+ <array >
76
+ <bean class =" com.github.pagehelper.PageHelper" >
77
+ <property name =" properties" >
78
+ <value >
79
+ dialect=mysql
80
+ reasonable=true
81
+ </value >
82
+ </property >
83
+ </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 >
93
+ </array >
94
+ </property >
95
+ </bean >
96
96
97
- <bean class =" org.mybatis.spring.mapper.MapperScannerConfigurer" >
98
- <property name =" basePackage" value =" com.isea533.mybatis.mapper" />
99
- </bean >
97
+ <bean class =" org.mybatis.spring.mapper.MapperScannerConfigurer" >
98
+ <property name =" addToConfig" value =" true" />
99
+ <property name =" basePackage" value =" com.isea533.mybatis.mapper" />
100
+ </bean >
100
101
101
- <bean id =" sqlSession" class =" org.mybatis.spring.SqlSessionTemplate" scope =" prototype" >
102
- <constructor-arg index =" 0" ref =" sqlSessionFactory" />
103
- </bean >
102
+ <bean id =" sqlSession" class =" org.mybatis.spring.SqlSessionTemplate" scope =" prototype" >
103
+ <constructor-arg index =" 0" ref =" sqlSessionFactory" />
104
+ </bean >
104
105
105
- <aop : aspectj-autoproxy />
106
+ <aop : aspectj-autoproxy />
106
107
107
- <aop : config >
108
- <aop : pointcut id =" appService" expression =" execution(* com.isea533.mybatis.service..*Service*.*(..))" />
109
- <aop : advisor advice-ref =" txAdvice" pointcut-ref =" appService" />
110
- </aop : config >
108
+ <aop : config >
109
+ <aop : pointcut id =" appService" expression =" execution(* com.isea533.mybatis.service..*Service*.*(..))" />
110
+ <aop : advisor advice-ref =" txAdvice" pointcut-ref =" appService" />
111
+ </aop : config >
111
112
112
- <tx : advice id =" txAdvice" transaction-manager =" transactionManager" >
113
- <tx : attributes >
114
- <tx : method name =" select*" read-only =" true" />
115
- <tx : method name =" find*" read-only =" true" />
116
- <tx : method name =" get*" read-only =" true" />
117
- <tx : method name =" *" />
118
- </tx : attributes >
119
- </tx : advice >
113
+ <tx : advice id =" txAdvice" transaction-manager =" transactionManager" >
114
+ <tx : attributes >
115
+ <tx : method name =" select*" read-only =" true" />
116
+ <tx : method name =" find*" read-only =" true" />
117
+ <tx : method name =" get*" read-only =" true" />
118
+ <tx : method name =" *" />
119
+ </tx : attributes >
120
+ </tx : advice >
120
121
121
- <bean id =" transactionManager" class =" org.springframework.jdbc.datasource.DataSourceTransactionManager" >
122
- <property name =" dataSource" ref =" dataSource" />
123
- </bean >
122
+ <bean id =" transactionManager" class =" org.springframework.jdbc.datasource.DataSourceTransactionManager" >
123
+ <property name =" dataSource" ref =" dataSource" />
124
+ </bean >
124
125
</beans >
0 commit comments