Subversion Repositories SmartDukaan

Rev

Rev 2280 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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