| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:aop="http://www.springframework.org/schema/aop" xmlns:task="http://www.springframework.org/schema/task"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:cache="http://www.springframework.org/schema/cache" 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.0.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd
- http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
- http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
- http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd">
- <bean id="propertyConfigurer"
- class="com.uas.platform.b2c.core.support.EncryptablePropertyPlaceholderConfigurer">
- <property name="locations">
- <list>
- <value>classpath*:${profile}/*.properties</value>
- </list>
- </property>
- </bean>
- <!--<context:property-placeholder location="classpath*:${profile}/*.properties" />-->
- <!-- 系统运行参数注入 -->
- <util:properties id="sys"
- location="classpath:${profile}/sys.properties" />
- <!-- 消息参数 -->
- <util:properties id="message"
- location="classpath:${profile}/message.properties" />
- <!-- 注册spring上下文对象 -->
- <bean class="com.uas.platform.b2c.core.support.ApplicationContextRegister" />
- <!-- 容器启动完成之后执行 -->
- <bean class="com.uas.platform.b2c.core.support.ContextRefreshedProcessor" />
- <context:component-scan base-package="com.uas.platform" />
- <context:annotation-config />
- <!-- 开启@AspectJ AOP代理 -->
- <aop:aspectj-autoproxy />
- <!-- 任务调度器 -->
- <task:scheduler id="scheduler" pool-size="10" />
- <!-- 任务执行器 -->
- <task:executor id="executor" pool-size="10" />
- <!--开启注解调度支持 @Async @Scheduled -->
- <task:annotation-driven executor="executor"
- scheduler="scheduler" proxy-target-class="true" />
- <!-- 国际化的消息资源文件(本系统中主要用于显示/错误消息定制) -->
- <bean id="messageSource"
- class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
- <property name="basenames">
- <list>
- <value>classpath:spring/messages</value>
- </list>
- </property>
- <property name="useCodeAsDefaultMessage" value="false" />
- <property name="defaultEncoding" value="UTF-8" />
- <property name="cacheSeconds" value="60" />
- </bean>
- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
- destroy-method="close">
- <property name="driverClassName" value="${jdbc.driverClassName}" />
- <property name="url" value="${jdbc.url}" />
- <property name="username" value="${jdbc.username}" />
- <property name="password" value="${jdbc.password}" />
- <!-- 连接初始值,连接池启动时创建的连接数量的初始值 -->
- <property name="initialSize" value="${jdbc.initialSize}" />
- <!-- 连接池的最大值,同一时间可以从池分配的最多连接数量,0时无限制 -->
- <property name="maxActive" value="${jdbc.maxActive}" />
- <!-- 最大空闲值.当经过一个高峰时间后,连接池可以慢慢将已经用不到的连接慢慢释放一部分,一直减少到maxIdle为止 ,0时无限制 -->
- <property name="maxIdle" value="${jdbc.maxIdle}" />
- <!-- 最小空闲值.当空闲的连接数少于阀值时,连接池就会预申请去一些连接,以免洪峰来时来不及申请 -->
- <property name="minIdle" value="${jdbc.minIdle}" />
- <!-- 是否对已备语句进行池管理(布尔值),是否对PreparedStatement进行缓存 -->
- <property name="poolPreparedStatements" value="true" />
- <!-- 是否对sql进行自动提交 -->
- <property name="defaultAutoCommit" value="true" />
- <!-- 回收超时连接 -->
- <property name="removeAbandoned" value="true" />
- <!-- 连接空闲时校验连接有效性 -->
- <property name="testWhileIdle" value="true" />
- <!-- 校验连接有效性的sql -->
- <property name="validationQuery" value="select 1 from dual" />
- <!-- 每过timeBetweenEvictionRunsMillis 时间,就会启动一个线程,校验连接池中闲置时间超过minEvictableIdleTimeMillis的连接对象 -->
- <property name="timeBetweenEvictionRunsMillis" value="${jdbc.timeBetweenEvictionRunsMillis}" />
- <property name="minEvictableIdleTimeMillis" value="${jdbc.minEvictableIdleTimeMillis}" />
- </bean>
- <!-- hibernate jpa -->
- <bean class="org.springframework.orm.jpa.JpaTransactionManager"
- id="transactionManager">
- <property name="entityManagerFactory" ref="entityManagerFactory" />
- </bean>
- <tx:annotation-driven transaction-manager="transactionManager" />
- <bean id="transactionInterceptor"
- class="org.springframework.transaction.interceptor.TransactionInterceptor">
- <property name="transactionManager" ref="transactionManager" />
- <property name="transactionAttributeSource">
- <bean
- class="org.springframework.transaction.annotation.AnnotationTransactionAttributeSource"></bean>
- </property>
- </bean>
- <bean id="transactionAttributeSourceAdvisor"
- class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor">
- <property name="transactionInterceptor" ref="transactionInterceptor" />
- </bean>
- <bean id="entityManagerFactory"
- class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
- <property name="persistenceUnitName" value="persistenceUnit" />
- <property name="persistenceXmlLocation" value="classpath*:META-INF/persistence.xml"/>
- <property name="packagesToScan" value="com.uas.platform" />
- <property name="dataSource" ref="dataSource" />
- <property name="jpaVendorAdapter">
- <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
- <property name="generateDdl" value="false" />
- <property name="databasePlatform" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
- <property name="showSql" value="false" />
- </bean>
- </property>
- <property name="jpaDialect">
- <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
- </property>
- <property name="jpaProperties">
- <props>
- <prop key="hibernate.cache.provider_configuration_file_resource_path">classpath:spring/ehcache.xml</prop>
- <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
- </prop>
- <prop key="hibernate.cache.use_query_cache">true</prop>
- <prop key="hibernate.cache.use_second_level_cache">true</prop>
- <prop key="hibernate.generate_statistics">true</prop>
- <prop key="hibernate.use_sql_comments">true</prop>
- <prop key="hibernate.format_sql">true</prop>
- <prop key="hibernate.generate_statistics">true</prop>
- <prop key="hibernate.enable_lazy_load_no_trans">true</prop>
- </props>
- </property>
- </bean>
- <!-- jdbctemplate -->
- <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource" ref="dataSource" />
- </bean>
- <!-- 使用ehcache对象缓存 -->
- <cache:annotation-driven />
- <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
- <property name="cacheManager" ref="ehcache"></property>
- </bean>
- <bean id="ehcache"
- class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
- <property name="configLocation" value="classpath:spring/ehcache.xml"></property>
- <property name="shared" value="true"></property>
- </bean>
- <!-- mail sender -->
- <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
- <property name="host" value="${email.host}" />
- <property name="port" value="${email.port}" />
- <property name="javaMailProperties">
- <props>
- <prop key="mail.smtp.auth">true</prop>
- <prop key="mail.smtp.timeout">25000</prop>
- <prop key="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
- <prop key="mail.smtp.port">465</prop>
- <prop key="mail.smtp.socketFactory.port">465</prop>
- </props>
- </property>
- <property name="username" value="${email.username}" />
- <property name="password" value="${email.password}" />
- </bean>
- <bean id="simpleMailMessage" class="org.springframework.mail.SimpleMailMessage">
- <property name="from" value="${email.from}" />
- </bean>
- <bean id="velocityEngine"
- class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
- <property name="velocityProperties">
- <props>
- <prop key="resource.loader">class</prop>
- <prop key="class.resource.loader.class">
- org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
- </prop>
- <prop key="velocimacro.library"></prop>
- </props>
- </property>
- </bean>
- <!-- 文件上传 -->
- <bean id="multipartResolver"
- class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
- <property name="defaultEncoding" value="utf-8"></property>
- </bean>
- <!-- 账户中心配置 -->
- <bean id="accountConfigurer" class="com.uas.account.web.AccountConfigurer"
- init-method="init">
- <property name="configPath" value="classpath:${profile}/account.properties" />
- </bean>
- <import resource="classpath:spring/ehcache.xml"/>
- <import resource="classpath:spring/jpa.xml"/>
- <import resource="classpath:spring/redis.xml"/>
- <import resource="classpath:spring/task.xml"/>
- </beans>
|