Add tests for the services
[smart-bookstore.git] / ServiceImplementation / src / main / resources / app-context.xml
blob0ac55e3e982417c22ae81e757a72c346901cf127
1 <?xml version="1.0" encoding="UTF-8"?>
3 <!--
4  *   
5  * This is a common dao with basic CRUD operations and is not limited to any 
6  * persistent layer implementation
7  * 
8  * Copyright (C) 2008  Imran M Yousuf (imyousuf@smartitengineering.com)
9  * 
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 3 of the License, or (at your option) any later version.
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21  *
22  *
23 -->
25 <!--
26     Document   : db-beanfactory.xml
27     Created on : May 20, 2008, 8:21 PM
28     Author     : imyousuf
29     Description:
30         This document will contain the Spring Application Context for the DB
31         Persistene Engine Implementation
32 -->
33 <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "spring-beans.dtd"  >
34 <beans>
35     <!-- 
36         Please make sure the following properties are availabe to the context
37         com.smartitengineering.dao.connection.driver_class
38         com.smartitengineering.dao.connection.url
39         com.smartitengineering.dao.connection.username
40         com.smartitengineering.dao.connection.password
41         com.smartitengineering.dao.dialect
42         com.smartitengineering.dao.show_sql
43     -->
44     <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
45         <property name="locations">
46             <list>
47                 <value>classpath:db-config.properties</value>
48             </list>
49         </property>
50         <property name="properties" >
51             <props>
52                 <prop key="hibernate.connection.driver_class">${com.smartitengineering.dao.connection.driver_class}
53                 </prop>
54                 <prop key="hibernate.connection.url">${com.smartitengineering.dao.connection.url}
55                 </prop>
56                 <prop key="hibernate.connection.username">${com.smartitengineering.dao.connection.username}
57                 </prop>
58                 <prop key="hibernate.connection.password">${com.smartitengineering.dao.connection.password}
59                 </prop>
60                 <prop key="hibernate.dialect">${com.smartitengineering.dao.dialect}
61                 </prop>
62                 <prop key="hibernate.show_sql">${com.smartitengineering.dao.show_sql}
63                 </prop>
64             </props>
65         </property>
66     </bean>
68     <!-- Local C3P0 DataSource that works in any environment -->
69     <!-- (Both DataSource implementations have a "close" method to be called on shutdown) -->
70     <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
71         <property name="driverClass">
72             <value>${hibernate.connection.driver_class}</value>
73         </property>
74         <property name="jdbcUrl">
75             <value>${hibernate.connection.url}</value>
76         </property>
77         <property name="user">
78             <value>${hibernate.connection.username}</value>
79         </property>
80         <property name="password">
81             <value>${hibernate.connection.password}</value>
82         </property>
83         <property name="acquireIncrement">
84             <value>5</value>
85         </property>
86         <property name="checkoutTimeout">
87             <value>5000</value>
88         </property>
89         <property name="initialPoolSize">
90             <value>5</value>
91         </property>
92         <property name="maxIdleTime">
93             <value>120</value>
94         </property>
95         <!-- Will never expire (seconds)-->
96         <property name="maxPoolSize">
97             <value>30</value>
98         </property>
99         <property name="maxStatements">
100             <value>500</value>
101         </property>
102         <property name="maxStatementsPerConnection">
103             <value>12</value>
104         </property>
105         <property name="minPoolSize">
106             <value>3</value>
107         </property>
108         <property name="numHelperThreads">
109             <value>4</value>
110         </property>
111     </bean>
112     
113     <!-- Hibernate SessionFactory -->
114     <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
115         <property name="dataSource">
116             <ref local="dataSource" />
117         </property>
118         <property name="mappingResources">
119             <list>
120                 <value>hbm/PublicationHouse.hbm.xml</value>                
121             </list>
122         </property>
123         <property name="hibernateProperties">
124             <props>
125                 <prop key="hibernate.dialect">${hibernate.dialect}
126                 </prop>
127                 <prop key="hibernate.autoCommit">true
128                 </prop>
129                 <prop key="hibernate.show_sql">${hibernate.show_sql}
130                 </prop>
131                 <prop key="hibernate.hbm2ddl.auto">create-drop</prop>
132                 <prop key="hibernate.query.substitutions">true 'T', false 'F'
133                 </prop>
134             </props>
135         </property>
136     </bean>
137     <bean id="abstractDao" class="com.smartitengineering.dao.impl.hibernate.AbstractDAO" abstract="true">
138         <property name="sessionFactory">
139             <ref local="sessionFactory" />
140         </property>
141     </bean>
142     <bean id="daoImpl" class="com.smartitengineering.bookstore.serviceimplementation.AbstractDaoImpl" parent="abstractDao">
143     </bean>
144 </beans>