| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 | <?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:jee="http://www.springframework.org/schema/jee"	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"	xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:jdbc="http://www.springframework.org/schema/jdbc"	xmlns:util="http://www.springframework.org/schema/util" xmlns:aop="http://www.springframework.org/schema/aop" 	xmlns:repository="http://www.springframework.org/schema/data/repository"	xmlns:mvc="http://www.springframework.org/schema/mvc"	xsi:schemaLocation="        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd        http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd        http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd        http://www.springframework.org/schema/data/repository http://www.springframework.org/schema/data/repository/spring-repository.xsd"	default-lazy-init="true">	<description>Spring公共配置 </description>	<context:property-placeholder		ignore-resource-not-found="true" location="classpath*:spring/application.properties" />	<!-- 使用annotation 自动注册bean, 并保证@Required、@Autowired的属性被注入. @Controller的Bean注入在spring-mvc.xml中自动注册 -->	<context:component-scan base-package="com.xt.jygl">		<context:exclude-filter type="annotation"			expression="org.springframework.stereotype.Controller" />	</context:component-scan>			<bean id="propertiesGisReader"  		class="org.springframework.beans.factory.config.PropertiesFactoryBean">	  <property name="locations">	   	<list>	    	<!--<value>classpath:param.properties</value>-->	    	<value>/WEB-INF/config/gis.properties</value>	   	</list>	  </property>	</bean>	<!-- Jpa Entity Manager 配置 -->	<bean id="entityManagerFactory"		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">		<property name="persistenceUnitName" value="persistence_unit_1" />		<property name="dataSource" ref="dataSource" />		<property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapter" />		<property name="packagesToScan" value="com.xt.jygl,com.xtframe" />		<property name="jpaProperties">			<props>				<prop key="hibernate.dialect">${hibernate.dialect}</prop>				<prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy				</prop>				<prop key="hibernate.show_sql">false</prop>				<prop key="hibernate.format_sql">false</prop>			</props>		</property>	</bean>	<bean id="hibernateConfuration" class="org.hibernate.cfg.Configuration">		<property name="properties">			<props>				<prop key="hibernate.dialect">${hibernate.dialect}</prop>				<prop key="hibernate.connection.driver_class">${jdbc.driver}</prop>				<prop key="hibernate.connection.url">${jdbc.url}</prop>				<prop key="hibernate.connection.username">${jdbc.username}</prop>				<prop key="hibernate.connection.password">${jdbc.password}</prop>			</props>		</property>	</bean>	<bean id="hibernateJpaVendorAdapter"		class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />	<!-- Spring Data Jpa配置 -->	<jpa:repositories base-package="com.xt.jygl,com.xtframe.sec"		transaction-manager-ref="transactionManager"		entity-manager-factory-ref="entityManagerFactory"		factory-class="com.xtframe.sec.common.SecRepositoryFactoryBean" />	<!-- JPA 事务配置 -->	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">		<property name="entityManagerFactory" ref="entityManagerFactory" />	</bean>	<tx:advice id="txAdvice" transaction-manager="transactionManager">		<tx:attributes>			<tx:method name="add*" propagation="REQUIRED" />			<tx:method name="delete*" propagation="REQUIRED" />			<tx:method name="logic*" propagation="REQUIRED" />			<tx:method name="update*" propagation="REQUIRED" />			<tx:method name="save*" propagation="REQUIRED" />			<tx:method name="submit*" propagation="REQUIRED" />			<tx:method name="claim*" propagation="REQUIRED" />			<tx:method name="create*" propagation="REQUIRED" />			<tx:method name="complete*" propagation="REQUIRED" />			<tx:method name="autoComplete*" propagation="REQUIRED" />			<tx:method name="reject*" propagation="REQUIRED" />			<tx:method name="change*" propagation="REQUIRED" />			<tx:method name="sendMail" propagation="REQUIRED" />			<tx:method name="reSubmit*" propagation="REQUIRED" />			<tx:method name="do*" propagation="REQUIRED" />			<tx:method name="*" propagation="SUPPORTS" read-only="true" />		</tx:attributes>	</tx:advice>	<!-- Hibernate事务配置 -->	<bean id="hibernate-transactionManager"		class="org.springframework.orm.hibernate4.HibernateTransactionManager">		<property name="sessionFactory" ref="sessionFactory" />	</bean>	<!-- 使用annotation定义事务 -->	<!--tx:annotation-driven transaction-manager="transactionManager"		proxy-target-class="true" /-->		<!--bean id="aspectBean" class="com.xtframe.TestAspect" />	<aop:config>		<aop:aspect id="TestAspect" ref="aspectBean">			<aop:pointcut id="businessService"					  expression="execution(* (com.xt.jygl.common.service.JyglBaseService+).*(..))" />			<aop:before pointcut-ref="businessService" method="doBefore"/>			<aop:after pointcut-ref="businessService" method="doAfter"/>			<aop:around pointcut-ref="businessService" method="doAround"/>			<aop:after-throwing pointcut-ref="businessService" method="doThrowing" throwing="ex"/>		</aop:aspect>	</aop:config-->	<aop:config>		<aop:pointcut id="txPointcut"					  expression="execution(* (com.xt.jygl.common.service.JyglBaseService+).*(..))" />		<aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut" />	</aop:config>	<bean id="sessionFactory"		class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">		<property name="dataSource" ref="dataSource" />		<property name="hibernateProperties">			<props>				<prop key="hibernate.dialect">${hibernate.dialect}</prop>				<prop key="hibernate.show_sql">false</prop>				<prop key="hibernate.format_sql">true</prop>				<prop key="hibernate.jdbc.fetch_size">50</prop>				<prop key="hibernate.jdbc.batch_size">25</prop>				<prop key="hibernate.temp.use_jdbc_metadata_defaults">false</prop>			</props>		</property>	</bean>	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">		<property name="dataSource" ref="dataSource" />	</bean>	<bean id="webConfiguration" class="com.xtframe.web.support.XtWebConfiguration">		<property name="entityManagerFactory" ref="entityManagerFactory" />		<property name="entityManager">			<bean class="org.springframework.orm.jpa.support.SharedEntityManagerBean">				<property name="persistenceUnitName" value="persistence_unit_1" />			</bean>		</property>	</bean>	<!-- 调度器 -->	<bean name="schedulerFactoryBean"		class="org.springframework.scheduling.quartz.SchedulerFactoryBean">		<!-- 通过applicationContextSchedulerContextKey属性配置spring上下文 -->		<property name="applicationContextSchedulerContextKey">			<value>applicationContext</value>		</property>	</bean>	<bean id="webContext" class="com.xtframe.web.support.XtWebContextFactoryBean">		<property name="webConfiguration" ref="webConfiguration" />		<property name="scheduler" ref="schedulerFactoryBean" />	</bean>	<bean id="securityContext" factory-bean="webContext"		factory-method="getSecurityContext" />	<bean id="bizLogRecorder" factory-bean="securityContext"		factory-method="getBizLogRecorder" />	<bean id="queryService" factory-bean="securityContext"		factory-method="getQueryService" />	<bean id="menuService" factory-bean="securityContext"		factory-method="getMenuService" />	<bean id="securityMgr" factory-bean="securityContext"		factory-method="getSecurityMgr" />			<!-- 数据源配置,使用应用内的DBCP数据库连接池 -->	<!-- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"		destroy-method="close" lazy-init="false">		Connection Info		<property name="driverClassName" value="${jdbc.driver}" />		<property name="url" value="${jdbc.url}" />		<property name="username" value="${jdbc.username}" />		<property name="password" value="${jdbc.password}" />		Connection Pooling Info		<property name="maxIdle" value="${dbcp.maxIdle}" />		<property name="maxActive" value="${dbcp.maxActive}" />		<property name="defaultAutoCommit" value="false" />		<property name="timeBetweenEvictionRunsMillis" value="3600000" />		<property name="minEvictableIdleTimeMillis" value="3600000" />	</bean> -->	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"		destroy-method="close" lazy-init="false">		<!-- Connection Info -->		<property name="driverClassName" value="${jdbc.driver}" />		<property name="url" value="${jdbc.url}" />		<property name="username" value="${jdbc.username}" />		<property name="password" value="${jdbc.password}" />		<!-- Connection Pooling Info -->		<!-- 连接池启动时的初始值 -->		<property name="initialSize" value="${dbcp.initialSize}" /> 		<!-- 最大连接数据库连接数,设置为0时,表示没有限制 -->		<property name="maxActive" value="${dbcp.maxActive}" />		<!-- 最大等待连接中的数量,设置为0时,表示没有限制 -->		<property name="maxIdle" value="${dbcp.maxIdle}" />		<!-- 最小等待连接中的数量,设置为0时,表示没有限制 -->		<property name="minIdle" value="${dbcp.minIdle}" />		<!-- sql验证 主要是防止重启数据库时,去先前已有的连接时报错,这个是在需要连接验证时用到 -->		<property name="validationQuery" value="SELECT 1 FROM DUAL " />		<!-- 取出连接时进行有效性验证 默认是true,设置为false,提高性能 -->		<property name="testOnBorrow" value="false" />		<!-- 最大等待时间 -->		<property name="maxWait" value="60000" />		<!-- 设置从数据源中返回的连接是否采用自动提交机制,默认值为 true -->		<property name="defaultAutoCommit" value="false" />		<!-- 每30秒运行一次空闲连接回收器,如果当前连接数小于minIdle会去创建 -->		<property name="timeBetweenEvictionRunsMillis" value="300000" />		<!-- 池中的连接空闲30分钟后被回收 -->		<property name="minEvictableIdleTimeMillis" value="1800000" />	</bean></beans>
 |