All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ch.inftec.ju.testing.db.AbstractBaseDbTest-context.xml Maven / Gradle / Ivy

<?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:jpa="http://www.springframework.org/schema/data/jpa"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:security="http://www.springframework.org/schema/security"
	xsi:schemaLocation="
	http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
	http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
	http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
	http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">	
	
	<!-- Enable annotation based configuration (including transactions) -->
	<!--  	<context:annotation-config /> -->
	<tx:annotation-driven/>
		
	<!-- ########################## -->
	<!-- Define DB connection infos -->
	<!-- ########################## -->

	<!--Persistence -->
	<bean id="juConnectionInfo" class="ch.inftec.ju.db.ConnectionInfoImpl">
		<property name="name" value="Derby Test DB"/>
		<property name="connectionString" value="jdbc:derby:memory:juTestingDb;create=true"/>
		<property name="userName" value="sa"/>
		<property name="password" value=""/>
	</bean>
	
	<!-- Define DataSource -->
	
	<bean id="dataSource" class="ch.inftec.ju.db.ConnectionInfoDriverManagerDataSource">
		<property name="connectionInfo" ref="juConnectionInfo"/>
	</bean>
	
	<!-- Define and configure the EntityManagerFactory -->
	<bean id="entityManagerFactory"
		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
		<property name="dataSource" ref="dataSource"/>
		<property name="persistenceXmlLocation" value="classpath:ch/inftec/ju/testing/db/AbstractBaseDbTest-persistence.xml"/>
		<property name="persistenceUnitName" value="Derby ju-testing"/>
		
		<property name="jpaVendorAdapter">
			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/>
		</property>
	</bean>

	<!-- Define the TransactionManager -->
	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"/>
	
	<!-- ################################## -->
	<!-- Define Ju specific helpers objects -->
	<!-- ################################## -->
	
	<!-- Define Spring specific helper objects -->
	<bean id="testDb" class="ch.inftec.ju.testing.db.data.DerbyTestDb"/>
	<bean id="juDbUtils" class="ch.inftec.ju.db.JuDbUtils">
		<property name="entityManagerFactory" ref="entityManagerFactory"/>
	</bean>
	
	<!-- ###################################### -->
	<!-- Define Spring specific helpers objects -->
	<!-- ###################################### -->
	
	<!-- Define JdbcTemplate -->
	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
		<property name="dataSource" ref="dataSource"/>
	</bean>
	
	<!-- Define Repositories -->
	<jpa:repositories base-package="ch.inftec.ju.testing.db.data.repo" />

</beans>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy