fd3a6d1d79a2908e5ef00ad13287ec9ddbd93e7d.svn-base
6.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<?xml version="1.0" encoding="UTF-8"?>
<!--
共有方法,负责所有共有配置文件
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<!-- hibernate注入 -->
<!-- 配置C3P0,数据源(营销中心数据库) -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/yxybase?useUnicode=true&characterEncoding=utf8&autoReconnect=true</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>sz1234567890</value>
</property>
<property name="maxActive">
<value>100</value>
</property>
<property name="maxIdle">
<value>50</value>
</property>
<property name="initialSize">
<value>30</value>
</property>
<property name="maxWait">
<value>10000</value>
</property>
<property name="defaultAutoCommit">
<value>true</value>
</property>
<property name="removeAbandoned">
<value>true</value>
</property>
<property name="removeAbandonedTimeout">
<value>300</value>
</property>
<property name="logAbandoned">
<value>false</value>
</property>
<property name="validationQuery">
<value>select 1</value>
</property>
<property name="testOnBorrow">
<value>true</value>
</property>
</bean>
<!-- 配置C3P0,数据源(点读数据库)-->
<bean id="clickdataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://gz-cdb-2xtb8c5k.sql.tencentcdb.com:62529/sqlesmailtrack?useUnicode=true&characterEncoding=utf8&autoReconnect=true</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>sz1234567890</value>
</property>
<property name="maxActive">
<value>100</value>
</property>
<property name="maxIdle">
<value>50</value>
</property>
<property name="initialSize">
<value>30</value>
</property>
<property name="maxWait">
<value>10000</value>
</property>
<property name="defaultAutoCommit">
<value>true</value>
</property>
<property name="removeAbandoned">
<value>true</value>
</property>
<property name="removeAbandonedTimeout">
<value>300</value>
</property>
<property name="logAbandoned">
<value>false</value>
</property>
<property name="validationQuery">
<value>select 1</value>
</property>
<property name="testOnBorrow">
<value>true</value>
</property>
</bean>
<!-- ================================数据源配置===============================================================-->
<!-- 配置 营销中心数据库 注解sessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<!-- 数据源注入 -->
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan">
<list>
<value>yxy.timer.pojo</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">false</prop>
<!-- 如果开启, Hibernate将收集有助于性能调节的统计数据. 取值 true | false -->
<prop key="hibernate.generate_statistics">true</prop>
<!-- 指定Hibernate在何时释放JDBC连接. -->
<prop key="hibernate.connetion.release_mode">auto</prop>
</props>
</property>
</bean>
<!--配置公共的hibernate方法注解 -->
<bean id="AnnhibernateBaseDAO" class="yxy.timer.dao.impl.HibernateBaseDAOImpl" abstract="true" scope="prototype">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!--3、配置spring事务(AOP) -->
<!-- 事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- 事务的传播特性(propagation) -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="del*"/>
<tx:method name="save*" />
<tx:method name="update*" />
<tx:method name="add*" />
<tx:method name="insert*" />
<tx:method name="get*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="load*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="list*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="*" propagation="SUPPORTS" read-only="true"/>
</tx:attributes>
</tx:advice>
<!-- 配置哪些类哪些方法具有事务 ,采用AOP-->
<aop:config>
<aop:pointcut expression="execution(* yxy.timer.service.*.*(..))" id="allMethod"/>
<aop:advisor pointcut-ref="allMethod" advice-ref="txAdvice"/>
</aop:config>
<!-- 注入SpringFactory类 -->
<bean id="springfactory" class="yxy.timer.tool.SpringFactory"></bean>
<!-- dao模块 -->
<import resource="applicationContext_dao.xml"/>
<!-- service模块 -->
<import resource="applicationContext_service.xml"/>
<!-- 邮件timer模块 -->
<import resource="applicationContext_timer.xml"/>
<!-- webservice模块 -->
<import resource="applicationContext_webservice.xml"/>
<!-- sale100个人版模块 -->
<import resource="applicationContext_sale100.xml"/>
</beans>