Advertisement
Guest User

dataSource-contex.xml

a guest
Feb 22nd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 4.51 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
  4.     xmlns:context="http://www.springframework.org/schema/context"
  5.     xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang"
  6.     xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util"
  7.     xmlns:p="http://www.springframework.org/schema/p"
  8.     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  9.         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
  10.         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
  11.         http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
  12.         http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.0.xsd
  13.         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
  14.         http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
  15.         http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"
  16.     default-autowire="byName">
  17.  
  18.  
  19.     <bean id="dataSource"
  20.         class="org.springframework.jdbc.datasource.DriverManagerDataSource"
  21.         p:driverClassName="${dataSource.driverClassName}" p:url="${dataSource.url}"
  22.         p:username="${dataSource.username}" p:password="${dataSource.password}" />
  23.  
  24.     <bean id="pum"
  25.         class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
  26.         <property name="persistenceXmlLocations">
  27.             <list>
  28.                 <value>classpath*:META-INF/persistence.xml</value>
  29.                 <value>classpath*:META-INF/inv-persistence.xml</value>
  30.                 <value>classpath*:META-INF/inv-custom-persistence.xml</value>
  31.                 <value>classpath*:META-INF/sls-persistence.xml</value>
  32.                 <value>classpath*:META-INF/sls-custom-persistence.xml</value>
  33.                 <value>classpath*:META-INF/master-persistence.xml</value>
  34.                 <value>classpath*:META-INF/master-custom-persistence.xml</value>
  35.                 <value>classpath*:META-INF/jms-persistence.xml</value>
  36.                 <value>classpath*:META-INF/approval-persistence.xml</value>
  37.                 <value>classpath*:META-INF/autonum-persistence.xml</value>
  38.             </list>
  39.         </property>
  40.         <property name="persistenceUnitPostProcessors">
  41.             <bean class="org.jleaf.core.orm.jpa.MergingPersistenceUnitPostProcessor" />
  42.         </property>
  43.     </bean>
  44.     <bean
  45.         class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
  46.         id="entityManagerFactory" p:dataSource-ref="dataSource">
  47.         <property name="persistenceUnitManager" ref="pum" />
  48.  
  49.  
  50.         <property name="jpaVendorAdapter">
  51.             <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
  52.                 p:database="POSTGRESQL" p:showSql="false" p:generateDdl="false" />
  53.         </property>
  54.         <property name="jpaProperties">
  55.             <props>
  56.                 <prop key="hibernate.hbm2ddl">validate</prop>
  57.                 <prop key="hibernate.connection.driver_class">${dataSource.driverClassName}</prop>
  58.                 <prop key="hibernate.connection.username">${dataSource.username}</prop>
  59.                 <prop key="hibernate.connection.password">${dataSource.password}</prop>
  60.                 <prop key="hibernate.connection.url">${dataSource.url}</prop>
  61.                
  62.                 <prop key="hibernate.c3p0.min_size">${sls.conn.min_size}</prop>
  63.                 <prop key="hibernate.c3p0.max_size">${sls.conn.max_size}</prop>
  64.                 <prop key="hibernate.c3p0.timeout">${sls.conn.timeout}</prop>
  65.                 <prop key="hibernate.c3p0.max_statements">${sls.conn.max_statements}</prop>
  66.                 <prop key="hibernate.c3p0.idle_test_period">${sls.conn.idle_test_period}</prop>
  67.             </props>
  68.         </property>
  69.  
  70.     </bean>
  71.  
  72.     <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
  73.         <property name="entityManagerFactory" ref="entityManagerFactory" />
  74.         <property name="dataSource" ref="dataSource" />
  75.     </bean>
  76.  
  77.     <!-- JDBC template -->
  78.     <!--
  79.     <bean id="jdbcDataSource"
  80.         class="org.springframework.jdbc.datasource.DriverManagerDataSource"
  81.         p:driverClassName="${dataSource.driverClassName}" p:url="${dataSource.url}"
  82.         p:username="${dataSource.username}" p:password="${dataSource.password}" />
  83.     -->
  84.      
  85.     <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
  86.         <property name="dataSource" ref="dataSource" />
  87.     </bean>
  88. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement