- 数据源配置
数据源1配置
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" 4 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd" 5 default-autowire="byName"> 6 <bean id="dataSource-hr" class="com.alibaba.druid.pool.DruidDataSource" 7 init-method="init" destroy-method="close"> 8 <property name="url" value="${jdbc.url}" /> 9 <property name="username" value="${jdbc.username}" /> 10 <property name="password" value="${jdbc.password}" /> 11 12 <property name="filters" value="stat" /> 13 14 <property name="maxActive" value="20" /> 15 <property name="initialSize" value="1" /> 16 <property name="maxWait" value="60000" /> 17 <property name="minIdle" value="1" /> 18 19 <property name="timeBetweenEvictionRunsMillis" value="60000" /> 20 <property name="minEvictableIdleTimeMillis" value="300000" /> 21 22 <property name="validationQuery" value="SELECT 'x'" /> 23 <property name="testWhileIdle" value="true" /> 24 <property name="testOnBorrow" value="false" /> 25 <property name="testOnReturn" value="false" /> 26 27 <property name="poolPreparedStatements" value="true" /> 28 <property name="maxPoolPreparedStatementPerConnectionSize" 29 value="50" /> 30 </bean> 31 32 <!-- Hibernate Jpa SessionFactory --> 33 <bean id="sessionFactory" 34 class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> 35 <property name="dataSource" ref="dataSource-hr" /> 36 <property name="hibernateProperties"> 37 <props> 38 <prop key="hibernate.dialect">${hibernate.dialect}</prop> 39 <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> 40 <prop key="hibernate.format_sql">${hibernate.format_sql}</prop> 41 <prop key="hibernate.jdbc.fetch_size">200</prop> 42 <prop key="hibernate.jdbc.batch_size">200</prop> 43 <prop key="javax.persistence.validation.mode">none</prop> 44 </props> 45 </property> 46 <property name="packagesToScan"> 47 <list> 48 <value>com.xx.xx.pojo</value> 49 </list> 50 </property> 51 </bean> 52 </beans>
相关文章: