app-resources.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xmlns:aop="http://www.springframework.org/schema/aop"
  6. xmlns:tx="http://www.springframework.org/schema/tx"
  7. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  8. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
  9. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
  10. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
  11. default-autowire="byName" default-lazy-init="false">
  12. <!-- component-scan @Component , @Controller , @Service , @Repository -->
  13. <context:component-scan base-package="com.hotent.*.dao" />
  14. <context:component-scan base-package="com.hotent.*.service" />
  15. <context:component-scan base-package="com.hotent.core.table"/>
  16. <context:component-scan base-package="com.hotent.platform.event.listener"/>
  17. <context:component-scan base-package="com.hotent.weixin.impl"/>
  18. <context:component-scan base-package="com.haiya.*.dao" />
  19. <context:component-scan base-package="com.haiya.*.service" />
  20. <context:component-scan base-package="com.haiya.*.script" />
  21. <!-- 国际化资源 去掉后,保存操作会出错valid is not defined-->
  22. <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource" scope="prototype">
  23. <property name="basenames">
  24. <list>
  25. <!--<value>classpath:resource/errors</value> -->
  26. <value>classpath:resource/form</value>
  27. <value>classpath:resource/message</value>
  28. <value>classpath:resource/mobile</value>
  29. </list>
  30. </property>
  31. <property name="useCodeAsDefaultMessage" value="true"/>
  32. <property name="cacheSeconds" value="0"></property>
  33. <property name="defaultEncoding" value="UTF-8"></property>
  34. </bean>
  35. <bean id="localeResolver"
  36. class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
  37. </bean>
  38. <!--加载配置文件-->
  39. <bean id="configproperties"
  40. class="org.springframework.beans.factory.config.PropertiesFactoryBean">
  41. <property name="location" value="classpath:/conf/app.properties"/>
  42. </bean>
  43. <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  44. <property name="properties" ref="configproperties"/>
  45. </bean>
  46. <!--对数据库操作都从这里取jdbcTemplate-->
  47. <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
  48. <property name="dataSource" ref="dataSource"/>
  49. </bean>
  50. <!-- 单独给序号使用的,指定了系统的默认数据源。 -->
  51. <bean id="jdbcTemplateSn" class="org.springframework.jdbc.core.JdbcTemplate">
  52. <property name="dataSource" ref="dataSource_Default"/>
  53. </bean>
  54. <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  55. <property name="configLocation" value="classpath:/conf/configuration.xml"/>
  56. <property name="dataSource" ref="dataSource" />
  57. <property name="mapperLocations" >
  58. <list>
  59. <value>classpath:/com/hotent/*/maper/*.map.xml</value>
  60. <value>classpath:/com/haiya/*/maper/*.map.xml</value>
  61. </list>
  62. </property>
  63. </bean>
  64. <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
  65. <constructor-arg index="0" ref="sqlSessionFactory" />
  66. </bean>
  67. <!--
  68. 密码不加密数据源:com.alibaba.druid.pool.DruidDataSource
  69. 密码加密数据源:com.hotent.core.db.CustomDruidDataSource
  70. -->
  71. <bean id="dataSource_Default" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
  72. <!-- 基本属性 url、user、password -->
  73. <property name="url" value="${jdbc.url}" />
  74. <property name="username" value="${jdbc.username}" />
  75. <property name="password" value="${jdbc.password}" />
  76. <!-- 配置初始化大小、最小、最大 -->
  77. <property name="initialSize" value="${db.minimumConnectionCount}" />
  78. <property name="minIdle" value="${db.minimumConnectionCount}" />
  79. <property name="maxActive" value="${db.maximumConnectionCount}" />
  80. <!-- 配置获取连接等待超时的时间 -->
  81. <property name="maxWait" value="60000" />
  82. <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
  83. <property name="timeBetweenEvictionRunsMillis" value="60000" />
  84. <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
  85. <property name="minEvictableIdleTimeMillis" value="300000" />
  86. <property name="validationQuery" value="select * from ACT_GE_PROPERTY" />
  87. <property name="testWhileIdle" value="true" />
  88. <property name="testOnBorrow" value="false" />
  89. <property name="testOnReturn" value="false" />
  90. <!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
  91. <property name="poolPreparedStatements" value="true" />
  92. <property name="maxPoolPreparedStatementPerConnectionSize" value="20" />
  93. <!-- 配置监控统计拦截的filters -->
  94. <property name="filters" value="stat" />
  95. <!-- 连接泄漏监测 -->
  96. <property name="removeAbandoned" value="true" /> <!-- 打开removeAbandoned功能 -->
  97. <property name="removeAbandonedTimeout" value="28800" /> <!-- 28800秒,也就是8小时,一个连接超过8小时会自动删除这个连接 -->
  98. <property name="logAbandoned" value="true" /> <!-- 关闭abanded连接时输出错误日志 -->
  99. </bean>
  100. <bean id="stat-filter" class="com.alibaba.druid.filter.stat.StatFilter">
  101. <property name="slowSqlMillis" value="10000" />
  102. <property name="logSlowSql" value="true" />
  103. <property name="mergeSql" value="true" />
  104. </bean>
  105. <!--
  106. <bean id="dataSource_Default" class="org.logicalcobwebs.proxool.ProxoolDataSource">
  107. <property name="driver" value="${jdbc.driverClassName}"/>
  108. <property name="driverUrl" value="${jdbc.url}"/>
  109. <property name="user" value="${jdbc.username}"/>
  110. <property name="password" value="${jdbc.password}"/>
  111. <property name="alias" value="${db.alias}"/>
  112. <property name="simultaneousBuildThrottle" value="${db.simultaneousBuildThrottle}"/>
  113. <property name="maximumActiveTime" value="${db.maximumActiveTime}"/>
  114. <property name="houseKeepingTestSql" value="${db.houseKeepingTestSql}"/>
  115. <property name="maximumConnectionCount" value="${db.maximumConnectionCount}"/>
  116. <property name="minimumConnectionCount" value="${db.minimumConnectionCount}"/>
  117. <property name="delegateProperties" value="characterEncoding=${db.characterEncoding}"/>
  118. <property name="testBeforeUse" value="true"></property>
  119. </bean>
  120. -->
  121. <!-- 动态数据源start############################################################-->
  122. <!-- 数据源导入拦截bean -->
  123. <bean id="dataSourceInitListener" class="com.hotent.platform.event.listener.DataSourceInitListener"></bean>
  124. <bean id="dataSource" class="com.hotent.core.db.datasource.DynamicDataSource">
  125. <property name="targetDataSources" >
  126. <map>
  127. <entry key="dataSource_Default" value-ref="dataSource_Default" />
  128. </map>
  129. </property>
  130. <property name="defaultTargetDataSource" ref="dataSource_Default" />
  131. </bean>
  132. <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  133. <property name="dataSource" ref="dataSource" />
  134. </bean>
  135. <bean id="logAspect" class="com.hotent.platform.aop.LogAspect"/>
  136. <bean id="sysUrlPermissionFilter" class="com.hotent.platform.web.filter.SysUrlPermissionFilter"/>
  137. <bean id="bpmAspect" class="com.hotent.platform.service.bpm.BpmAspect"/>
  138. <aop:config proxy-target-class="true">
  139. <aop:advisor advice-ref="txAdvice" pointcut="execution(* com.hotent.platform.service..*.*(..))" />
  140. <aop:advisor advice-ref="txAdvice" pointcut="execution(* com.haiya.produce.service..*.*(..))" />
  141. <!-- -->
  142. <aop:aspect ref="logAspect" >
  143. <aop:pointcut expression="execution(* com.hotent.platform.controller..*.*(..))" id="logPointcut"/>
  144. <aop:around pointcut-ref="logPointcut" method="doAudit"/>
  145. </aop:aspect>
  146. <aop:aspect ref="bpmAspect" order="100">
  147. <aop:pointcut expression="execution(* com.hotent.platform.service..*.*(..))" id="pointCutBpm"/>
  148. <aop:after method="doAfter" pointcut-ref="pointCutBpm" />
  149. </aop:aspect>
  150. <aop:aspect ref="sysUrlPermissionFilter">
  151. <aop:pointcut expression="execution(* com.hotent.platform.controller..*.*(..))
  152. &amp;&amp; !execution(* com.hotent.platform.controller.console.*.*(..))" id="urlPointcut"/>
  153. <aop:before pointcut-ref="urlPointcut" method="doHandler"/>
  154. <aop:pointcut expression="execution(* com.hotent.platform.controller.system.SysUrlPermissionController.save(..)) || execution(* com.hotent.platform.controller.system.SysUrlPermissionController.del(..))" id="modifyUrlPointcut"/>
  155. <aop:after-returning pointcut-ref="modifyUrlPointcut" method="initMap"/>
  156. </aop:aspect>
  157. </aop:config>
  158. <tx:advice id="txAdvice" transaction-manager="transactionManager">
  159. <tx:attributes>
  160. <tx:method name="nextId" propagation="REQUIRES_NEW"/>
  161. <tx:method name="get*" read-only="true" />
  162. <tx:method name="is*" read-only="true"/>
  163. <tx:method name="find*" read-only="true"/>
  164. <tx:method name="*" />
  165. </tx:attributes>
  166. </tx:advice>
  167. <!-- Spring编程式事务 -->
  168. <bean id="txTemplate" class="org.springframework.transaction.support.TransactionTemplate">
  169. <property name="transactionManager" ref="transactionManager"></property>
  170. <property name="propagationBehaviorName" value="PROPAGATION_REQUIRED"></property>
  171. </bean>
  172. <!-- 文件模版引擎配置 -->
  173. <bean id="freemarkerConfiguration" class="org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean">
  174. <property name="templateLoaderPath" value="classpath:template/" />
  175. <property name="defaultEncoding" value="UTF-8"/>
  176. </bean>
  177. <bean id="templateLoader" class="freemarker.cache.StringTemplateLoader"></bean>
  178. <!-- freemaker引擎 -->
  179. <bean id="freemarkEngine" class="com.hotent.core.engine.FreemarkEngine">
  180. <property name="configuration" ref="freemarkerConfiguration"/>
  181. </bean>
  182. <bean id="mailSeting" class="com.hotent.core.mail.model.MailSeting">
  183. <property name="sendHost" value="${mail.host}"/>
  184. <property name="sendPort" value="${mail.port}"/>
  185. <property name="SSL" value="${mail.ssl}"/>
  186. <property name="protocal" value="smtp"/>
  187. <property name="validate" value="true"/>
  188. <property name="nickName" value="${mail.nickName}"/>
  189. <property name="mailAddress" value="${mail.username}"/>
  190. <property name="password" value="${mail.password}"/>
  191. </bean>
  192. <bean id="mailUtil" class="com.hotent.core.mail.MailUtil">
  193. <constructor-arg ref="mailSeting"></constructor-arg>
  194. </bean>
  195. <!-- QUARTZ 2.0配置的问题 -->
  196. <bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
  197. lazy-init="false" destroy-method="destroy">
  198. <property name="autoStartup" value="false" />
  199. <property name="waitForJobsToCompleteOnShutdown" value="false" />
  200. <property name="dataSource" ref="dataSource" />
  201. <property name="overwriteExistingJobs" value="true" />
  202. <property name="startupDelay" value="60"></property>
  203. <property name="jobFactory">
  204. <bean class="org.quartz.simpl.SimpleJobFactory"></bean>
  205. </property>
  206. <property name="quartzProperties">
  207. <props>
  208. <prop key="org.quartz.scheduler.instanceName">ClusteredScheduler</prop>
  209. <prop key="org.quartz.scheduler.instanceId">AUTO</prop>
  210. <prop key="org.quartz.scheduler.skipUpdateCheck">true</prop>
  211. <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
  212. <prop key="org.quartz.threadPool.threadCount">5</prop>
  213. <prop key="org.quartz.threadPool.threadPriority">5</prop>
  214. <prop key="org.quartz.jobStore.class">org.quartz.impl.jdbcjobstore.JobStoreTX</prop>
  215. <prop key="org.quartz.jobStore.driverDelegateClass">${quartz.jdbcjobstore}</prop>
  216. <prop key="org.quartz.jobStore.misfireThreshold">60000</prop>
  217. <prop key="org.quartz.jobStore.useProperties">false</prop>
  218. <prop key="org.quartz.jobStore.tablePrefix">QRTZ_</prop>
  219. <prop key="org.quartz.jobStore.isClustered">true</prop>
  220. <prop key="org.quartz.jobStore.clusterCheckinInterval">20000</prop>
  221. <prop key="org.quartz.scheduler.classLoadHelper.class">org.quartz.simpl.CascadingClassLoadHelper</prop>
  222. <prop key="org.quartz.jobStore.lockHandler.class">org.quartz.impl.jdbcjobstore.UpdateLockRowSemaphore</prop>
  223. <prop key="org.quartz.jobStore.lockHandler.updateLockRowSQL">UPDATE QRTZ_LOCKS SET LOCK_NAME = LOCK_NAME WHERE LOCK_NAME = ?</prop>
  224. </props>
  225. </property>
  226. </bean>
  227. <!-- activity directory 活动目录配置-->
  228. <context:component-scan base-package="com.hotent.core.ldap.dao.impl" />
  229. <bean id="ldapSource" class="org.springframework.ldap.core.support.LdapContextSource">
  230. <property name="url" value="${ldapUrl}" />
  231. <property name="base" value="${ldapBase}" />
  232. <property name="userDn" value="${ldapUserDn}" />
  233. <property name="password" value="${ldapPassword}" />
  234. <property name="pooled" value="${ldapPooled}"></property>
  235. </bean>
  236. <bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
  237. <property name="ContextSource" ref="ldapSource"></property>
  238. <property name="ignorePartialResultException" value="true"/>
  239. </bean>
  240. <!--动态数据源缓存器
  241. <bean id="dynamicDataSourceCache" class="com.hotent.core.db.DynamicDataSourceCache"/>
  242. -->
  243. <!--高级查询缓存器-->
  244. <bean id="searchCache" class="com.hotent.core.web.query.scan.SearchCache">
  245. <property name="basePackage" >
  246. <list>
  247. <value>classpath:com/hotent/**/model/**/*.class</value>
  248. </list>
  249. </property>
  250. </bean>
  251. <bean id="multipartResolver" class="com.hotent.core.web.CustomerMultipartResolver">
  252. <!-- 设置上传文件的最大尺寸为100MB -->
  253. <property name="maxUploadSize" value="${maxUploadSize}" />
  254. <!-- 请求的编码格式,必须和jSP的pageEncoding属性一致,以便正确读取表单的内容,默认为ISO-8859-1 -->
  255. <property name="defaultEncoding">
  256. <value>UTF-8</value>
  257. </property>
  258. </bean>
  259. </beans>