| Line 1... |
Line 1... |
| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<!--
|
- |
|
| 3 |
Copyright 2010 The myBatis Team
|
- |
|
| 4 |
|
- |
|
| 5 |
Licensed under the Apache License, Version 2.0 (the "License");
|
2 |
<!-- Copyright 2010 The myBatis Team Licensed under the Apache License, Version
|
| 6 |
you may not use this file except in compliance with the License.
|
3 |
2.0 (the "License"); you may not use this file except in compliance with
|
| 7 |
You may obtain a copy of the License at
|
- |
|
| 8 |
|
- |
|
| 9 |
http://www.apache.org/licenses/LICENSE-2.0
|
4 |
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
|
- |
|
| 11 |
Unless required by applicable law or agreed to in writing, software
|
5 |
Unless required by applicable law or agreed to in writing, software distributed
|
| 12 |
distributed under the License is distributed on an "AS IS" BASIS,
|
6 |
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
|
| 13 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
7 |
OR CONDITIONS OF ANY KIND, either express or implied. See the License for
|
| 14 |
See the License for the specific language governing permissions and
|
8 |
the specific language governing permissions and limitations under the License. -->
|
| 15 |
limitations under the License.
|
- |
|
| 16 |
-->
|
- |
|
| 17 |
|
9 |
|
| 18 |
<beans xmlns="http://www.springframework.org/schema/beans"
|
10 |
<beans xmlns="http://www.springframework.org/schema/beans"
|
| 19 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
- |
|
| 20 |
xmlns:aop="http://www.springframework.org/schema/aop"
|
11 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
|
| 21 |
xmlns:tx="http://www.springframework.org/schema/tx"
|
- |
|
| 22 |
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
12 |
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
| 23 |
xmlns:context="http://www.springframework.org/schema/context"
|
13 |
xmlns:context="http://www.springframework.org/schema/context"
|
| 24 |
xsi:schemaLocation="
|
14 |
xsi:schemaLocation="
|
| 25 |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
15 |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
| 26 |
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
16 |
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
| 27 |
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
|
17 |
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
|
| 28 |
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
|
18 |
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
|
| 29 |
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
|
19 |
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
|
| 30 |
|
20 |
|
| 31 |
<bean id="dataSource"
|
21 |
<context:property-placeholder location="classpath:jdbc.properties" />
|
| - |
|
22 |
|
| 32 |
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
|
23 |
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
|
| - |
|
24 |
<!-- JDBC connection properties -->
|
| 33 |
<property name="driverClassName" value="${jdbc.driverClassName}"/>
|
25 |
<property name="driverClassName" value="${jdbc.driverClassName}" />
|
| 34 |
<property name="url" value="${jdbc.url}"/>
|
26 |
<property name="url" value="${jdbc.url}" />
|
| 35 |
<property name="username" value="${jdbc.username}"/>
|
27 |
<property name="username" value="${jdbc.username}" />
|
| 36 |
<property name="password" value="${jdbc.password}"/>
|
28 |
<property name="password" value="${jdbc.password}" />
|
| - |
|
29 |
|
| - |
|
30 |
<!-- Pool size related properties -->
|
| - |
|
31 |
<!-- The initial number of connections that are created when the pool is
|
| - |
|
32 |
started. -->
|
| - |
|
33 |
<property name="initialSize" value="2" />
|
| - |
|
34 |
|
| - |
|
35 |
<!-- The maximum number of active connections that can be allocated from
|
| - |
|
36 |
this pool at the same time, or negative for no limit. -->
|
| - |
|
37 |
<property name="maxActive" value="16" />
|
| - |
|
38 |
|
| - |
|
39 |
<!-- The maximum number of milliseconds that the pool will wait (when there
|
| - |
|
40 |
are no available connections) for a connection to be returned before throwing
|
| - |
|
41 |
an exception, or -1 to wait indefinitely. -->
|
| - |
|
42 |
<property name="maxWait" value="10000" />
|
| - |
|
43 |
|
| - |
|
44 |
<!-- The SQL query that will be used to validate connections from this
|
| - |
|
45 |
pool before returning them to the caller. If specified, this query MUST be
|
| - |
|
46 |
an SQL SELECT statement that returns at least one row. -->
|
| - |
|
47 |
<property name="validationQuery" value="SELECT 1" />
|
| - |
|
48 |
|
| - |
|
49 |
<!-- The indication of whether objects will be validated before being borrowed
|
| - |
|
50 |
from the pool. If the object fails to validate, it will be dropped from the
|
| - |
|
51 |
pool, and we will attempt to borrow another. -->
|
| - |
|
52 |
<property name="testOnBorrow" value="false" />
|
| - |
|
53 |
|
| - |
|
54 |
<!-- The indication of whether objects will be validated by the idle object
|
| - |
|
55 |
evictor (if any). If an object fails to validate, it will be dropped from
|
| - |
|
56 |
the pool. -->
|
| - |
|
57 |
<property name="testWhileIdle" value="true" />
|
| - |
|
58 |
|
| - |
|
59 |
<!-- The minimum amount of time an object may sit idle in the pool before
|
| - |
|
60 |
it is eligable for eviction by the idle object evictor. Setting it to 2 hours. -->
|
| - |
|
61 |
<property name="minEvictableIdleTimeMillis" value="7200000" />
|
| - |
|
62 |
|
| - |
|
63 |
<!-- The number of milliseconds to sleep between runs of the idle object
|
| - |
|
64 |
evictor thread. When non-positive, no idle object evictor thread will be
|
| - |
|
65 |
run. Setting it to 15 minutes. -->
|
| - |
|
66 |
<property name="timeBetweenEvictionRunsMillis" value="1800000"></property>
|
| - |
|
67 |
|
| - |
|
68 |
<!-- Properties to prevent DB resource leaks -->
|
| - |
|
69 |
<!-- Flag to remove abandoned connections if they exceed the removeAbandonedTimout.
|
| - |
|
70 |
If set to true a connection is considered abandoned and eligible for removal
|
| - |
|
71 |
if it has been idle longer than the removeAbandonedTimeout. Setting this
|
| - |
|
72 |
to true can recover db connections from poorly written applications which
|
| - |
|
73 |
fail to close a connection. -->
|
| - |
|
74 |
<property name="removeAbandoned" value="true" />
|
| - |
|
75 |
|
| - |
|
76 |
<!-- Timeout in seconds before an abandoned connection can be removed. -->
|
| - |
|
77 |
<property name="removeAbandonedTimeout" value="300" />
|
| - |
|
78 |
|
| - |
|
79 |
<!-- Flag to log stack traces for application code which abandoned a Statement
|
| - |
|
80 |
or Connection. Logging of abandoned Statements and Connections adds overhead
|
| - |
|
81 |
for every Connection open or new Statement because a stack trace has to be
|
| - |
|
82 |
generated -->
|
| - |
|
83 |
<property name="logAbandoned" value="true" />
|
| - |
|
84 |
</bean>
|
| - |
|
85 |
|
| - |
|
86 |
<!-- transaction manager, use JtaTransactionManager for global tx -->
|
| - |
|
87 |
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
| - |
|
88 |
<property name="dataSource" ref="dataSource" />
|
| 37 |
</bean>
|
89 |
</bean>
|
| 38 |
|
- |
|
| 39 |
<context:property-placeholder location="classpath:jdbc.properties"/>
|
- |
|
| 40 |
|
90 |
|
| 41 |
<!-- in-memory database and a datasource -->
|
- |
|
| 42 |
<!-- <jdbc:embedded-database id="dataSource"> -->
|
- |
|
| 43 |
<!-- <jdbc:script location="classpath:database/jpetstore-hsqldb-schema.sql"/> -->
|
- |
|
| 44 |
<!-- <jdbc:script location="classpath:database/jpetstore-hsqldb-dataload.sql"/> -->
|
- |
|
| 45 |
<!-- </jdbc:embedded-database> -->
|
- |
|
| 46 |
|
- |
|
| 47 |
<!-- transaction manager, use JtaTransactionManager for global tx -->
|
91 |
<!-- enable component scanning (beware that this does not enable mapper
|
| 48 |
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
- |
|
| 49 |
<property name="dataSource" ref="dataSource" />
|
- |
|
| 50 |
</bean>
|
92 |
scanning!) -->
|
| 51 |
|
- |
|
| 52 |
<!-- enable component scanning (beware that this does not enable mapper scanning!) -->
|
- |
|
| 53 |
<context:component-scan base-package="in.shop2020.payment.handler" />
|
93 |
<context:component-scan base-package="in.shop2020.payment.handler" />
|
| 54 |
|
94 |
|
| 55 |
<!-- enable autowire -->
|
95 |
<!-- enable autowire -->
|
| 56 |
<context:annotation-config />
|
96 |
<context:annotation-config />
|
| 57 |
|
97 |
|
| 58 |
<!-- enable transaction demarcation with annotations -->
|
98 |
<!-- enable transaction demarcation with annotations -->
|
| 59 |
<tx:annotation-driven />
|
99 |
<tx:annotation-driven />
|
| 60 |
|
100 |
|
| 61 |
<!-- define the SqlSessionFactory, notice that configLocation is not needed when you use MapperFactoryBean -->
|
101 |
<!-- define the SqlSessionFactory, notice that configLocation is not needed
|
| - |
|
102 |
when you use MapperFactoryBean -->
|
| 62 |
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
103 |
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
| 63 |
<property name="dataSource" ref="dataSource" />
|
104 |
<property name="dataSource" ref="dataSource" />
|
| 64 |
<property name="configLocation" value="classpath:mybatis-config.xml" />
|
105 |
<property name="configLocation" value="classpath:mybatis-config.xml" />
|
| 65 |
</bean>
|
106 |
</bean>
|
| 66 |
|
107 |
|
| 67 |
<!-- scan for mappers and let them be autowired -->
|
108 |
<!-- scan for mappers and let them be autowired -->
|
| 68 |
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
109 |
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
| 69 |
<property name="basePackage" value="in.shop2020.payment.persistence" />
|
110 |
<property name="basePackage" value="in.shop2020.payment.persistence" />
|
| 70 |
</bean>
|
111 |
</bean>
|
| 71 |
</beans>
|
112 |
</beans>
|