测试配置文件忘加国际化相关配置
This commit is contained in:
@@ -1,137 +1,150 @@
|
||||
<?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:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
|
||||
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.1.xsd
|
||||
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.1.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd"
|
||||
default-lazy-init="true">
|
||||
|
||||
<description>Spring Configuration Test</description>
|
||||
|
||||
<!-- 加载配置属性文件(谁先加载,谁优先级越高,jeesite.yml的优先级高于jeesite-core.yml)-->
|
||||
<bean id="yamlProperties" class="org.springframework.beans.factory.config.YamlPropertiesFactoryBean">
|
||||
<property name="resources">
|
||||
<array><value>classpath:jeesite-core.yml</value>
|
||||
<value>classpath:jeesite.yml</value></array>
|
||||
</property>
|
||||
</bean>
|
||||
<context:property-placeholder properties-ref="yamlProperties" ignore-unresolvable="true"/>
|
||||
|
||||
<!-- 使用Annotation自动注册Bean,解决事物失效问题:在主容器中不扫描@Controller注解,在SpringMvc中只扫描@Controller注解。 -->
|
||||
<context:component-scan base-package="com.jeesite"><!-- base-package 如果多个,用“,”分隔 -->
|
||||
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
|
||||
</context:component-scan>
|
||||
|
||||
<!-- 扫描包设置(MyBatis Aliases、MyBatis Mappers) -->
|
||||
<bean name="scanBasePackage" class="java.lang.String">
|
||||
<constructor-arg><value>com.jeesite</value></constructor-arg>
|
||||
</bean>
|
||||
|
||||
<!-- Spring Application Context Holder -->
|
||||
<bean id="springUtils" class="com.jeesite.common.utils.SpringUtils" lazy-init="false"></bean>
|
||||
|
||||
<!-- MyBatis SqlSessionFactoryBean -->
|
||||
<bean id="sqlSessionFactory" class="com.jeesite.common.mybatis.SqlSessionFactoryBean">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
<property name="typeAliasesPackage" ref="scanBasePackage"/>
|
||||
<property name="typeAliasesSuperType" value="com.jeesite.common.entity.BaseEntity"/>
|
||||
<property name="mapperLocations" value="classpath*:/mappings/**/*.xml"/>
|
||||
<property name="configLocation" value="classpath:/mybatis/mybatis-config.xml"></property>
|
||||
<property name="configurationProperties"><props>
|
||||
<prop key="_prefix">${jdbc.tablePrefix}</prop>
|
||||
</props></property>
|
||||
</bean>
|
||||
|
||||
<!-- 扫描basePackage下所有以@MyBatisDao注解的接口 -->
|
||||
<bean id="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
||||
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
|
||||
<property name="basePackage" ref="scanBasePackage"/>
|
||||
<property name="annotationClass" value="com.jeesite.common.mybatis.annotation.MyBatisDao"/>
|
||||
</bean>
|
||||
|
||||
<!-- 定义事务 -->
|
||||
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource" />
|
||||
</bean>
|
||||
|
||||
<!-- 配置 Annotation 驱动,扫描@Transactional注解的类定义事务 -->
|
||||
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
|
||||
|
||||
<!-- 多数据源配置 -->
|
||||
<bean id="dataSource" class="com.jeesite.common.datasource.RoutingDataSource">
|
||||
<property name="targetDataSources">
|
||||
<map key-type="java.lang.String"></map>
|
||||
</property>
|
||||
<property name="defaultTargetDataSource" ref="defaultDataSource"/>
|
||||
</bean>
|
||||
|
||||
<!-- 默认数据源配置, 使用 Druid 数据库连接池 -->
|
||||
<bean id="defaultDataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
|
||||
<!-- 数据源驱动类可不写,Druid默认会自动根据URL识别DriverClass -->
|
||||
<property name="driverClassName" value="${jdbc.driver}" />
|
||||
|
||||
<!-- 基本属性 url、user、password -->
|
||||
<property name="url" value="${jdbc.url}" />
|
||||
<property name="username" value="${jdbc.username}" />
|
||||
<property name="password" value="${jdbc.password}" />
|
||||
|
||||
<!-- 配置初始化大小、最小、最大 -->
|
||||
<property name="initialSize" value="${jdbc.pool.init}" />
|
||||
<property name="minIdle" value="${jdbc.pool.minIdle}" />
|
||||
<property name="maxActive" value="${jdbc.pool.maxActive}" />
|
||||
|
||||
<!-- 配置获取连接等待超时的时间 -->
|
||||
<property name="maxWait" value="60000" />
|
||||
|
||||
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
|
||||
<property name="timeBetweenEvictionRunsMillis" value="60000" />
|
||||
|
||||
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
|
||||
<property name="minEvictableIdleTimeMillis" value="300000" />
|
||||
|
||||
<!-- 泄露的连接可以被删除的超时值,单位秒
|
||||
<property name="removeAbandoned" value="true" />
|
||||
<property name="removeAbandonedTimeout" value="1800" />-->
|
||||
|
||||
<!-- <property name="validationQuery" value="${jdbc.testSql}" /> -->
|
||||
<property name="testWhileIdle" value="false" />
|
||||
<property name="testOnBorrow" value="false" />
|
||||
<property name="testOnReturn" value="false" />
|
||||
|
||||
<!-- 打开PSCache,并且指定每个连接上PSCache的大小(Oracle使用)
|
||||
<property name="poolPreparedStatements" value="true" />
|
||||
<property name="maxPoolPreparedStatementPerConnectionSize" value="20" /> -->
|
||||
|
||||
<!-- 配置监控统计拦截的filters -->
|
||||
<property name="filters" value="stat" />
|
||||
|
||||
<!-- 配置自定义的拦截器 -->
|
||||
<property name="proxyFilters">
|
||||
<list>
|
||||
<bean class="com.jeesite.common.datasource.filter.ConfigFilter" />
|
||||
</list>
|
||||
</property>
|
||||
|
||||
</bean>
|
||||
|
||||
<!-- 配置 JSR303 Bean Validator 定义 -->
|
||||
<bean id="beanValidator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
|
||||
<property name="providerClass" value="org.hibernate.validator.HibernateValidator"/>
|
||||
</bean>
|
||||
|
||||
<!-- 缓存配置 -->
|
||||
<bean id="ehCacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
|
||||
<!-- <property name="configLocation" value="classpath:${ehcache.configFile}" /> -->
|
||||
</bean>
|
||||
|
||||
<!-- 自定义系统缓存管理器-->
|
||||
<bean id="shiroCacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
|
||||
<property name="cacheManager" ref="ehCacheManager"/>
|
||||
</bean>
|
||||
|
||||
<?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:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
|
||||
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.1.xsd
|
||||
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.1.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd"
|
||||
default-lazy-init="true">
|
||||
|
||||
<description>Spring Configuration Test</description>
|
||||
|
||||
<!-- 加载配置属性文件(谁先加载,谁优先级越高,jeesite.yml的优先级高于jeesite-core.yml)-->
|
||||
<bean id="yamlProperties" class="org.springframework.beans.factory.config.YamlPropertiesFactoryBean">
|
||||
<property name="resources">
|
||||
<array><value>classpath:jeesite-core.yml</value>
|
||||
<value>classpath:jeesite.yml</value></array>
|
||||
</property>
|
||||
</bean>
|
||||
<context:property-placeholder properties-ref="yamlProperties" ignore-unresolvable="true"/>
|
||||
|
||||
<!-- 使用Annotation自动注册Bean,解决事物失效问题:在主容器中不扫描@Controller注解,在SpringMvc中只扫描@Controller注解。 -->
|
||||
<context:component-scan base-package="com.jeesite"><!-- base-package 如果多个,用“,”分隔 -->
|
||||
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
|
||||
</context:component-scan>
|
||||
|
||||
<!-- 扫描包设置(MyBatis Aliases、MyBatis Mappers) -->
|
||||
<bean name="scanBasePackage" class="java.lang.String">
|
||||
<constructor-arg><value>com.jeesite</value></constructor-arg>
|
||||
</bean>
|
||||
|
||||
<!-- Spring Application Context Holder -->
|
||||
<bean id="springUtils" class="com.jeesite.common.utils.SpringUtils" lazy-init="false"></bean>
|
||||
|
||||
<!-- MyBatis SqlSessionFactoryBean -->
|
||||
<bean id="sqlSessionFactory" class="com.jeesite.common.mybatis.SqlSessionFactoryBean">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
<property name="typeAliasesPackage" ref="scanBasePackage"/>
|
||||
<property name="typeAliasesSuperType" value="com.jeesite.common.entity.BaseEntity"/>
|
||||
<property name="mapperLocations" value="classpath*:/mappings/**/*.xml"/>
|
||||
<property name="configLocation" value="classpath:/mybatis/mybatis-config.xml"></property>
|
||||
<property name="configurationProperties"><props>
|
||||
<prop key="_prefix">${jdbc.tablePrefix}</prop>
|
||||
</props></property>
|
||||
</bean>
|
||||
|
||||
<!-- 扫描basePackage下所有以@MyBatisDao注解的接口 -->
|
||||
<bean id="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
||||
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
|
||||
<property name="basePackage" ref="scanBasePackage"/>
|
||||
<property name="annotationClass" value="com.jeesite.common.mybatis.annotation.MyBatisDao"/>
|
||||
</bean>
|
||||
|
||||
<!-- 定义事务 -->
|
||||
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource" />
|
||||
</bean>
|
||||
|
||||
<!-- 配置 Annotation 驱动,扫描@Transactional注解的类定义事务 -->
|
||||
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
|
||||
|
||||
<!-- 多数据源配置 -->
|
||||
<bean id="dataSource" class="com.jeesite.common.datasource.RoutingDataSource">
|
||||
<property name="targetDataSources">
|
||||
<map key-type="java.lang.String"></map>
|
||||
</property>
|
||||
<property name="defaultTargetDataSource" ref="defaultDataSource"/>
|
||||
</bean>
|
||||
|
||||
<!-- 默认数据源配置, 使用 Druid 数据库连接池 -->
|
||||
<bean id="defaultDataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
|
||||
<!-- 数据源驱动类可不写,Druid默认会自动根据URL识别DriverClass -->
|
||||
<property name="driverClassName" value="${jdbc.driver}" />
|
||||
|
||||
<!-- 基本属性 url、user、password -->
|
||||
<property name="url" value="${jdbc.url}" />
|
||||
<property name="username" value="${jdbc.username}" />
|
||||
<property name="password" value="${jdbc.password}" />
|
||||
|
||||
<!-- 配置初始化大小、最小、最大 -->
|
||||
<property name="initialSize" value="${jdbc.pool.init}" />
|
||||
<property name="minIdle" value="${jdbc.pool.minIdle}" />
|
||||
<property name="maxActive" value="${jdbc.pool.maxActive}" />
|
||||
|
||||
<!-- 配置获取连接等待超时的时间 -->
|
||||
<property name="maxWait" value="60000" />
|
||||
|
||||
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
|
||||
<property name="timeBetweenEvictionRunsMillis" value="60000" />
|
||||
|
||||
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
|
||||
<property name="minEvictableIdleTimeMillis" value="300000" />
|
||||
|
||||
<!-- 泄露的连接可以被删除的超时值,单位秒
|
||||
<property name="removeAbandoned" value="true" />
|
||||
<property name="removeAbandonedTimeout" value="1800" />-->
|
||||
|
||||
<!-- <property name="validationQuery" value="${jdbc.testSql}" /> -->
|
||||
<property name="testWhileIdle" value="false" />
|
||||
<property name="testOnBorrow" value="false" />
|
||||
<property name="testOnReturn" value="false" />
|
||||
|
||||
<!-- 打开PSCache,并且指定每个连接上PSCache的大小(Oracle使用)
|
||||
<property name="poolPreparedStatements" value="true" />
|
||||
<property name="maxPoolPreparedStatementPerConnectionSize" value="20" /> -->
|
||||
|
||||
<!-- 配置监控统计拦截的filters -->
|
||||
<property name="filters" value="stat" />
|
||||
|
||||
<!-- 配置自定义的拦截器 -->
|
||||
<property name="proxyFilters">
|
||||
<list>
|
||||
<bean class="com.jeesite.common.datasource.filter.ConfigFilter" />
|
||||
</list>
|
||||
</property>
|
||||
|
||||
</bean>
|
||||
|
||||
<!-- 数据库自动升级程序 -->
|
||||
<bean id="dbUpgrade" class="com.jeesite.common.db.DbUpgrade"></bean>
|
||||
|
||||
<!-- 配置国际化资源文件路径 -->
|
||||
<bean id="messageSource" class="com.jeesite.common.i18n.I18nMessageSource"
|
||||
depends-on="springUtils">
|
||||
</bean>
|
||||
|
||||
<!-- 基于Cookie和Session的本地化解析器 -->
|
||||
<bean id="localeResolver" class="com.jeesite.common.i18n.I18nLocaleResolver">
|
||||
<property name="defaultLocale" value="zh_CN" />
|
||||
</bean>
|
||||
|
||||
<!-- 配置 JSR303 Bean Validator 定义 -->
|
||||
<bean id="beanValidator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
|
||||
<property name="providerClass" value="org.hibernate.validator.HibernateValidator"/>
|
||||
</bean>
|
||||
|
||||
<!-- 缓存配置 -->
|
||||
<bean id="ehCacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
|
||||
<!-- <property name="configLocation" value="classpath:${ehcache.configFile}" /> -->
|
||||
</bean>
|
||||
|
||||
<!-- 自定义系统缓存管理器-->
|
||||
<bean id="shiroCacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
|
||||
<property name="cacheManager" ref="ehCacheManager"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user