huimv-servlet.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
  3. <beans>
  4. <!-- 配置文件加载 -->
  5. <bean id="propertyConfigure" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  6. <property name="locations">
  7. <list>
  8. <value>WEB-INF/config/dbconfig.properties</value>
  9. </list>
  10. </property>
  11. </bean>
  12. <!-- 数据源配置 -->
  13. <bean id="dataSourceW" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
  14. <property name="driverClassName">
  15. <value>${jdbc.driverClassName}</value>
  16. </property>
  17. <property name="url">
  18. <value>${jdbc.url}</value>
  19. </property>
  20. <property name="username">
  21. <value>${jdbc.username}</value>
  22. </property>
  23. <property name="password">
  24. <value>${jdbc.password}</value>
  25. </property>
  26. <property name="maxActive">
  27. <value>${maxActive}</value>
  28. </property>
  29. <property name="maxWait">
  30. <value>${maxWait}</value>
  31. </property>
  32. <property name="maxIdle">
  33. <value>${maxIdle}</value>
  34. </property>
  35. <property name="validationQuery">
  36. <value>${validationQuery}</value>
  37. </property>
  38. </bean>
  39. <bean id="dataSourceR1" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
  40. <property name="driverClassName">
  41. <value>${jdbc.driverClassName}</value>
  42. </property>
  43. <property name="url">
  44. <value>${jdbc.url.r1}</value>
  45. </property>
  46. <property name="username">
  47. <value>${jdbc.username.r1}</value>
  48. </property>
  49. <property name="password">
  50. <value>${jdbc.password.r1}</value>
  51. </property>
  52. <property name="maxActive">
  53. <value>${maxActive.r1}</value>
  54. </property>
  55. <property name="maxWait">
  56. <value>${maxWait.r1}</value>
  57. </property>
  58. <property name="maxIdle">
  59. <value>${maxIdle.r1}</value>
  60. </property>
  61. <property name="validationQuery">
  62. <value>${validationQuery.r1}</value>
  63. </property>
  64. </bean>
  65. <bean id="dataSource" class="com.huimv.busi.xt.utils.MultipleDataSource">
  66. <property name="defaultTargetDataSource" ref="dataSourceW"/>
  67. <property name="targetDataSources">
  68. <map>
  69. <entry key="dataSourceW" value-ref="dataSourceW"/>
  70. <entry key="dataSourceR1" value-ref="dataSourceR1"/>
  71. </map>
  72. </property>
  73. </bean>
  74. <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  75. <property name="dataSource" ref="dataSource"/>
  76. </bean>
  77. <!-- 业务逻辑层提供事务管理 -->
  78. <bean id="transactionProxyFactoryBean"
  79. class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
  80. lazy-init="true" abstract="true">
  81. <property name="transactionManager"><ref bean="transactionManager"/></property>
  82. <property name="transactionAttributes">
  83. <props>
  84. <prop key="save*">PROPAGATION_REQUIRED</prop>
  85. <prop key="insert*">PROPAGATION_REQUIRED</prop>
  86. <prop key="add*">PROPAGATION_REQUIRED</prop>
  87. <prop key="update*">PROPAGATION_REQUIRED</prop>
  88. <prop key="edit*">PROPAGATION_REQUIRED</prop>
  89. <prop key="delete*">PROPAGATION_REQUIRED</prop>
  90. <prop key="enable*">PROPAGATION_REQUIRED</prop>
  91. <!--
  92. <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
  93. -->
  94. </props>
  95. </property>
  96. </bean>
  97. <!-- jsp+Velocity双视图解析 -->
  98. <bean id="viewResolver" class="com.huimv.busi.xt.utils.MultipleViewResolver">
  99. <property name="resolvers">
  100. <map>
  101. <entry key="jsp">
  102. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  103. <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
  104. <property name="prefix">
  105. <value>/views/</value>
  106. </property>
  107. </bean>
  108. </entry>
  109. <entry key="htm">
  110. <bean class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
  111. <property name="contentType"><value>text/html;charset=utf-8</value></property>
  112. <property name="dateToolAttribute"><value>dateTool</value></property>
  113. <property name="numberToolAttribute"><value>numberTool</value></property>
  114. </bean>
  115. </entry>
  116. <entry key="html">
  117. <bean class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
  118. <property name="contentType"><value>text/html;charset=utf-8</value></property>
  119. <property name="dateToolAttribute"><value>dateTool</value></property>
  120. <property name="numberToolAttribute"><value>numberTool</value></property>
  121. </bean>
  122. </entry>
  123. </map>
  124. </property>
  125. </bean>
  126. <!-- Spring+Velocity集成配置 -->
  127. <bean id="velocityConfigurer"
  128. class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
  129. <property name="resourceLoaderPath" value="/views/" />
  130. <property name="velocityProperties">
  131. <props>
  132. <prop key="input.encoding">utf-8</prop>
  133. <prop key="output.encoding">utf-8</prop>
  134. </props>
  135. </property>
  136. </bean>
  137. <!-- Spring数据上传集成配置 -->
  138. <bean id="multipartResolver"
  139. class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
  140. <property name="maxUploadSize"><value>10485760</value></property>
  141. <property name="maxInMemorySize"><value>4096</value></property>
  142. </bean>
  143. <!-- 截获系统抛出的异常 -->
  144. <bean id="HMSException" class="com.huimv.busi.xt.utils.HMSException" />
  145. <!-- 各子系统的ibatis的ORMapping主控文件 -->
  146. <import resource="huimv-mapping-context.xml" />
  147. <!-- 各子系统的spring主控文件 -->
  148. <import resource="huimv-spring-context.xml" />
  149. <!-- 各子系统的controller主控文件 -->
  150. <import resource="huimv-controller-context.xml" />
  151. </beans>