spring-db.xml 4.02 KB
Newer Older
Matija Obreza's avatar
Matija Obreza committed
1 2
<?xml version="1.0" encoding="UTF-8"?>
<!--
Matija Obreza's avatar
Matija Obreza committed
3 4 5 6 7 8 9 10 11 12 13 14 15
	Copyright 2013 Global Crop Diversity Trust

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
Matija Obreza's avatar
Matija Obreza committed
16
-->
Matija Obreza's avatar
Matija Obreza committed
17 18
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/tx
Matija Obreza's avatar
Matija Obreza committed
19 20 21 22 23 24 25
       http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
       http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
       http://www.springframework.org/schema/data/jpa
       http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">


Matija Obreza's avatar
Matija Obreza committed
26
	<context:property-placeholder ignore-resource-not-found="true" location="classpath:/application.properties,classpath:/spring/spring.properties,classpath:/genesys.properties" />
Matija Obreza's avatar
Matija Obreza committed
27

Matija Obreza's avatar
Matija Obreza committed
28
	<bean name="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource">
Matija Obreza's avatar
Matija Obreza committed
29 30 31 32
		<property name="url" value="${db.url}" />
		<property name="driverClassName" value="${db.driverClassName}" />
		<property name="username" value="${db.username}" />
		<property name="password" value="${db.password}" />
Matija Obreza's avatar
Matija Obreza committed
33 34 35
		<property name="validationQuery" value="SELECT 1" />
		<property name="testWhileIdle" value="true" />
		<property name="testOnBorrow" value="true" />
36
		<!--
Matija Obreza's avatar
Matija Obreza committed
37 38 39 40
	 	<property name="timeBetweenEvictionRunsMillis" value="5000" />
		<property name="minEvictableIdleTimeMillis" value="5000" />
	 	<property name="minIdle" value="0" />
	 -->
Matija Obreza's avatar
Matija Obreza committed
41
	</bean>
Matija Obreza's avatar
Matija Obreza committed
42

Matija Obreza's avatar
Matija Obreza committed
43 44 45 46 47
	<bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory">
		<property name="dataSource" ref="dataSource" />
		<property name="persistenceUnitName" value="spring-jpa" />
		<property name="jpaVendorAdapter">
			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
Matija Obreza's avatar
Matija Obreza committed
48
				<property name="showSql" value="${db.showSql}" />
Matija Obreza's avatar
Matija Obreza committed
49 50 51 52
			</bean>
		</property>
		<property name="jpaProperties">
			<props>
Matija Obreza's avatar
Matija Obreza committed
53
				<prop key="hibernate.connection.autocommit">false</prop>
Matija Obreza's avatar
Matija Obreza committed
54
				<prop key="hibernate.hbm2ddl.auto">${db.hbm2ddl}</prop>
55
				<prop key="hibernate.search.default.indexBase">${lucene.indexDir}</prop>
56
				<prop key="hibernate.search.default.exclusive_index_use">false</prop>
57
                <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
Matija Obreza's avatar
Matija Obreza committed
58 59 60 61
			</props>
		</property>
		<property name="packagesToScan">
			<array>
Matija Obreza's avatar
Matija Obreza committed
62 63 64
				<value>org.genesys2.server.model.acl</value>
				<value>org.genesys2.server.model.impl</value>
				<value>org.genesys2.server.model.genesys</value>
Matija Obreza's avatar
Matija Obreza committed
65
				<value>org.genesys2.server.model.oauth</value>
Matija Obreza's avatar
Matija Obreza committed
66 67 68
			</array>
		</property>
	</bean>
69 70
	
	<jpa:auditing auditor-aware-ref="auditorAware" />
Matija Obreza's avatar
Matija Obreza committed
71

Matija Obreza's avatar
Matija Obreza committed
72 73 74 75
	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
		<property name="dataSource" ref="dataSource" />
		<property name="entityManagerFactory" ref="entityManagerFactory" />
	</bean>
Matija Obreza's avatar
Matija Obreza committed
76

Matija Obreza's avatar
Matija Obreza committed
77
	<tx:annotation-driven transaction-manager="transactionManager" />
Matija Obreza's avatar
Matija Obreza committed
78

Matija Obreza's avatar
Matija Obreza committed
79
	<jpa:repositories base-package="org.genesys2.server.persistence.domain" entity-manager-factory-ref="entityManagerFactory" transaction-manager-ref="transactionManager" repository-impl-postfix="CustomImpl" />
Matija Obreza's avatar
Matija Obreza committed
80

Matija Obreza's avatar
Matija Obreza committed
81
	<jpa:repositories base-package="org.genesys2.server.persistence.acl" entity-manager-factory-ref="entityManagerFactory" transaction-manager-ref="transactionManager" repository-impl-postfix="CustomImpl" />
Matija Obreza's avatar
Matija Obreza committed
82 83

</beans>