123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <?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:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
- default-autowire="byName" default-lazy-init="false">
- <!-- component-scan @Component , @Controller , @Service , @Repository -->
- <context:component-scan base-package="com.hotent.*.dao" />
- <context:component-scan base-package="com.hotent.*.service" />
- <context:component-scan base-package="com.hotent.core.table"/>
- <context:component-scan base-package="com.hotent.platform.event.listener"/>
- <context:component-scan base-package="com.hotent.weixin.impl"/>
-
-
- <context:component-scan base-package="com.haiya.*.dao" />
- <context:component-scan base-package="com.haiya.*.service" />
- <context:component-scan base-package="com.haiya.*.script" />
-
- <!-- 国际化资源 去掉后,保存操作会出错valid is not defined-->
- <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource" scope="prototype">
- <property name="basenames">
- <list>
- <!--<value>classpath:resource/errors</value> -->
- <value>classpath:resource/form</value>
- <value>classpath:resource/message</value>
- <value>classpath:resource/mobile</value>
- </list>
- </property>
- <property name="useCodeAsDefaultMessage" value="true"/>
- <property name="cacheSeconds" value="0"></property>
- <property name="defaultEncoding" value="UTF-8"></property>
- </bean>
- <bean id="localeResolver"
- class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
- </bean>
- <!--加载配置文件-->
- <bean id="configproperties"
- class="org.springframework.beans.factory.config.PropertiesFactoryBean">
- <property name="location" value="classpath:/conf/app.properties"/>
- </bean>
- <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="properties" ref="configproperties"/>
- </bean>
-
- <!--对数据库操作都从这里取jdbcTemplate-->
- <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource" ref="dataSource"/>
- </bean>
-
- <!-- 单独给序号使用的,指定了系统的默认数据源。 -->
- <bean id="jdbcTemplateSn" class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource" ref="dataSource_Default"/>
- </bean>
-
- <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
- <property name="configLocation" value="classpath:/conf/configuration.xml"/>
- <property name="dataSource" ref="dataSource" />
- <property name="mapperLocations" >
- <list>
- <value>classpath:/com/hotent/*/maper/*.map.xml</value>
- <value>classpath:/com/haiya/*/maper/*.map.xml</value>
- </list>
- </property>
- </bean>
- <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
- <constructor-arg index="0" ref="sqlSessionFactory" />
- </bean>
-
- <!--
- 密码不加密数据源:com.alibaba.druid.pool.DruidDataSource
- 密码加密数据源:com.hotent.core.db.CustomDruidDataSource
- -->
- <bean id="dataSource_Default" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
- <!-- 基本属性 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="${db.minimumConnectionCount}" />
- <property name="minIdle" value="${db.minimumConnectionCount}" />
- <property name="maxActive" value="${db.maximumConnectionCount}" />
-
- <!-- 配置获取连接等待超时的时间 -->
- <property name="maxWait" value="60000" />
-
- <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
- <property name="timeBetweenEvictionRunsMillis" value="60000" />
-
- <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
- <property name="minEvictableIdleTimeMillis" value="300000" />
-
- <property name="validationQuery" value="select * from ACT_GE_PROPERTY" />
- <property name="testWhileIdle" value="true" />
- <property name="testOnBorrow" value="false" />
- <property name="testOnReturn" value="false" />
-
- <!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
- <property name="poolPreparedStatements" value="true" />
- <property name="maxPoolPreparedStatementPerConnectionSize" value="20" />
-
- <!-- 配置监控统计拦截的filters -->
- <property name="filters" value="stat" />
- <!-- 连接泄漏监测 -->
- <property name="removeAbandoned" value="true" /> <!-- 打开removeAbandoned功能 -->
- <property name="removeAbandonedTimeout" value="28800" /> <!-- 28800秒,也就是8小时,一个连接超过8小时会自动删除这个连接 -->
- <property name="logAbandoned" value="true" /> <!-- 关闭abanded连接时输出错误日志 -->
-
- </bean>
-
- <bean id="stat-filter" class="com.alibaba.druid.filter.stat.StatFilter">
- <property name="slowSqlMillis" value="10000" />
- <property name="logSlowSql" value="true" />
- <property name="mergeSql" value="true" />
- </bean>
-
- <!--
- <bean id="dataSource_Default" class="org.logicalcobwebs.proxool.ProxoolDataSource">
- <property name="driver" value="${jdbc.driverClassName}"/>
- <property name="driverUrl" value="${jdbc.url}"/>
- <property name="user" value="${jdbc.username}"/>
- <property name="password" value="${jdbc.password}"/>
- <property name="alias" value="${db.alias}"/>
- <property name="simultaneousBuildThrottle" value="${db.simultaneousBuildThrottle}"/>
- <property name="maximumActiveTime" value="${db.maximumActiveTime}"/>
- <property name="houseKeepingTestSql" value="${db.houseKeepingTestSql}"/>
- <property name="maximumConnectionCount" value="${db.maximumConnectionCount}"/>
- <property name="minimumConnectionCount" value="${db.minimumConnectionCount}"/>
- <property name="delegateProperties" value="characterEncoding=${db.characterEncoding}"/>
- <property name="testBeforeUse" value="true"></property>
- </bean>
- -->
- <!-- 动态数据源start############################################################-->
- <!-- 数据源导入拦截bean -->
- <bean id="dataSourceInitListener" class="com.hotent.platform.event.listener.DataSourceInitListener"></bean>
-
- <bean id="dataSource" class="com.hotent.core.db.datasource.DynamicDataSource">
- <property name="targetDataSources" >
- <map>
- <entry key="dataSource_Default" value-ref="dataSource_Default" />
- </map>
- </property>
- <property name="defaultTargetDataSource" ref="dataSource_Default" />
- </bean>
-
-
-
- <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <property name="dataSource" ref="dataSource" />
- </bean>
-
- <bean id="logAspect" class="com.hotent.platform.aop.LogAspect"/>
- <bean id="sysUrlPermissionFilter" class="com.hotent.platform.web.filter.SysUrlPermissionFilter"/>
- <bean id="bpmAspect" class="com.hotent.platform.service.bpm.BpmAspect"/>
-
-
- <aop:config proxy-target-class="true">
- <aop:advisor advice-ref="txAdvice" pointcut="execution(* com.hotent.platform.service..*.*(..))" />
- <aop:advisor advice-ref="txAdvice" pointcut="execution(* com.haiya.produce.service..*.*(..))" />
- <!-- -->
- <aop:aspect ref="logAspect" >
- <aop:pointcut expression="execution(* com.hotent.platform.controller..*.*(..))" id="logPointcut"/>
- <aop:around pointcut-ref="logPointcut" method="doAudit"/>
- </aop:aspect>
-
- <aop:aspect ref="bpmAspect" order="100">
- <aop:pointcut expression="execution(* com.hotent.platform.service..*.*(..))" id="pointCutBpm"/>
- <aop:after method="doAfter" pointcut-ref="pointCutBpm" />
- </aop:aspect>
-
- <aop:aspect ref="sysUrlPermissionFilter">
- <aop:pointcut expression="execution(* com.hotent.platform.controller..*.*(..))
- && !execution(* com.hotent.platform.controller.console.*.*(..))" id="urlPointcut"/>
- <aop:before pointcut-ref="urlPointcut" method="doHandler"/>
- <aop:pointcut expression="execution(* com.hotent.platform.controller.system.SysUrlPermissionController.save(..)) || execution(* com.hotent.platform.controller.system.SysUrlPermissionController.del(..))" id="modifyUrlPointcut"/>
- <aop:after-returning pointcut-ref="modifyUrlPointcut" method="initMap"/>
- </aop:aspect>
-
- </aop:config>
- <tx:advice id="txAdvice" transaction-manager="transactionManager">
- <tx:attributes>
-
- <tx:method name="nextId" propagation="REQUIRES_NEW"/>
-
- <tx:method name="get*" read-only="true" />
- <tx:method name="is*" read-only="true"/>
- <tx:method name="find*" read-only="true"/>
- <tx:method name="*" />
- </tx:attributes>
- </tx:advice>
-
-
- <!-- Spring编程式事务 -->
- <bean id="txTemplate" class="org.springframework.transaction.support.TransactionTemplate">
- <property name="transactionManager" ref="transactionManager"></property>
- <property name="propagationBehaviorName" value="PROPAGATION_REQUIRED"></property>
- </bean>
-
- <!-- 文件模版引擎配置 -->
- <bean id="freemarkerConfiguration" class="org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean">
- <property name="templateLoaderPath" value="classpath:template/" />
- <property name="defaultEncoding" value="UTF-8"/>
- </bean>
-
-
- <bean id="templateLoader" class="freemarker.cache.StringTemplateLoader"></bean>
- <!-- freemaker引擎 -->
- <bean id="freemarkEngine" class="com.hotent.core.engine.FreemarkEngine">
- <property name="configuration" ref="freemarkerConfiguration"/>
- </bean>
-
- <bean id="mailSeting" class="com.hotent.core.mail.model.MailSeting">
- <property name="sendHost" value="${mail.host}"/>
- <property name="sendPort" value="${mail.port}"/>
- <property name="SSL" value="${mail.ssl}"/>
- <property name="protocal" value="smtp"/>
- <property name="validate" value="true"/>
- <property name="nickName" value="${mail.nickName}"/>
- <property name="mailAddress" value="${mail.username}"/>
- <property name="password" value="${mail.password}"/>
- </bean>
-
- <bean id="mailUtil" class="com.hotent.core.mail.MailUtil">
- <constructor-arg ref="mailSeting"></constructor-arg>
- </bean>
-
-
- <!-- QUARTZ 2.0配置的问题 -->
- <bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
- lazy-init="false" destroy-method="destroy">
- <property name="autoStartup" value="false" />
- <property name="waitForJobsToCompleteOnShutdown" value="false" />
- <property name="dataSource" ref="dataSource" />
- <property name="overwriteExistingJobs" value="true" />
- <property name="startupDelay" value="60"></property>
- <property name="jobFactory">
- <bean class="org.quartz.simpl.SimpleJobFactory"></bean>
- </property>
- <property name="quartzProperties">
- <props>
- <prop key="org.quartz.scheduler.instanceName">ClusteredScheduler</prop>
- <prop key="org.quartz.scheduler.instanceId">AUTO</prop>
- <prop key="org.quartz.scheduler.skipUpdateCheck">true</prop>
-
- <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
- <prop key="org.quartz.threadPool.threadCount">5</prop>
- <prop key="org.quartz.threadPool.threadPriority">5</prop>
-
- <prop key="org.quartz.jobStore.class">org.quartz.impl.jdbcjobstore.JobStoreTX</prop>
- <prop key="org.quartz.jobStore.driverDelegateClass">${quartz.jdbcjobstore}</prop>
- <prop key="org.quartz.jobStore.misfireThreshold">60000</prop>
- <prop key="org.quartz.jobStore.useProperties">false</prop>
- <prop key="org.quartz.jobStore.tablePrefix">QRTZ_</prop>
-
- <prop key="org.quartz.jobStore.isClustered">true</prop>
- <prop key="org.quartz.jobStore.clusterCheckinInterval">20000</prop>
-
- <prop key="org.quartz.scheduler.classLoadHelper.class">org.quartz.simpl.CascadingClassLoadHelper</prop>
- <prop key="org.quartz.jobStore.lockHandler.class">org.quartz.impl.jdbcjobstore.UpdateLockRowSemaphore</prop>
- <prop key="org.quartz.jobStore.lockHandler.updateLockRowSQL">UPDATE QRTZ_LOCKS SET LOCK_NAME = LOCK_NAME WHERE LOCK_NAME = ?</prop>
- </props>
- </property>
- </bean>
- <!-- activity directory 活动目录配置-->
- <context:component-scan base-package="com.hotent.core.ldap.dao.impl" />
- <bean id="ldapSource" class="org.springframework.ldap.core.support.LdapContextSource">
- <property name="url" value="${ldapUrl}" />
- <property name="base" value="${ldapBase}" />
- <property name="userDn" value="${ldapUserDn}" />
- <property name="password" value="${ldapPassword}" />
- <property name="pooled" value="${ldapPooled}"></property>
- </bean>
- <bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
- <property name="ContextSource" ref="ldapSource"></property>
- <property name="ignorePartialResultException" value="true"/>
- </bean>
- <!--动态数据源缓存器
- <bean id="dynamicDataSourceCache" class="com.hotent.core.db.DynamicDataSourceCache"/>
- -->
- <!--高级查询缓存器-->
- <bean id="searchCache" class="com.hotent.core.web.query.scan.SearchCache">
- <property name="basePackage" >
- <list>
- <value>classpath:com/hotent/**/model/**/*.class</value>
- </list>
- </property>
- </bean>
-
- <bean id="multipartResolver" class="com.hotent.core.web.CustomerMultipartResolver">
- <!-- 设置上传文件的最大尺寸为100MB -->
- <property name="maxUploadSize" value="${maxUploadSize}" />
- <!-- 请求的编码格式,必须和jSP的pageEncoding属性一致,以便正确读取表单的内容,默认为ISO-8859-1 -->
- <property name="defaultEncoding">
- <value>UTF-8</value>
- </property>
- </bean>
- </beans>
|