<?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:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:cache="http://www.springframework.org/schema/cache" 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-4.3.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"> <!-- 添加properties文件 --> <bean id="standardPBEStringEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor"> <property name="password" value="${atms_password:k5Cs7OmB5HdtVDOw94Py2V8HOvfmgbzeX9UCWDciqcjfhOulQLRuuJZkgV9zyIvO6QG22ZxOoYiJlCKrYP07O6nPFpcmN3XyNLJ}" /> </bean> <bean id="encryptablePropertyPlaceholderConfigurer" class="org.jasypt.spring31.properties.EncryptablePropertyPlaceholderConfigurer"> <property name="ignoreUnresolvablePlaceholders" value="true" /> <constructor-arg ref="standardPBEStringEncryptor" /> <property name="locations"> <list> <!-- Base settings for all environments --> <value>classpath:conf/conf_base.properties</value> <!-- Settings for selected environment --> <value>classpath:conf/conf.properties</value> </list> </property> </bean> <!-- **************************************************************** --> <!-- 启用注解, 启用component-scan --> <!-- **************************************************************** --> <context:component-scan base-package="pwc.taxtech.atms" > <context:exclude-filter type="annotation" expression="pwc.taxtech.atms.WebContext"/> </context:component-scan> <import resource="applicationContext-datasource.xml" /> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="configLocation" value="classpath:sqlMapConfig.xml" /> <property name="mapperLocations"> <array> <value>classpath*:pwc/taxtech/atms/**/*Mapper.xml</value> </array> </property> </bean> <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate"> <constructor-arg ref="sqlSessionFactory" /> </bean> <!-- <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="pwc.taxtech.atms" /> </bean> --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <tx:advice id="txAdvice"> <tx:attributes> <tx:method name="*" propagation="REQUIRED" rollback-for="Exception" /> </tx:attributes> </tx:advice> <aop:config proxy-target-class="true"> <aop:pointcut id="txPointcut2" expression="execution(public * pwc.taxtech.atms..*.*(..)) && @target(org.springframework.stereotype.Service)" /> <aop:advisor pointcut-ref="txPointcut2" advice-ref="txAdvice" /> </aop:config> <aop:aspectj-autoproxy /> <tx:annotation-driven proxy-target-class="true" /> <!-- 缓存配置 --> <!-- 启用缓存注解功能(请将其配置在Spring主配置文件中) --> <cache:annotation-driven cache-manager="cacheManager"/> <bean id="cacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> <property name="configLocation" value="classpath:ehcache.xml"/> </bean> <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"> <property name="cacheManager" ref="cacheManagerFactory"/> </bean> </beans>