config.xml 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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" xmlns:p="http://www.springframework.org/schema/p"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util"
  6. xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc"
  7. xsi:schemaLocation="http://www.springframework.org/schema/beans
  8. http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
  9. http://www.springframework.org/schema/context
  10. http://www.springframework.org/schema/context/spring-context-4.0.xsd
  11. http://www.springframework.org/schema/aop
  12. http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
  13. http://www.springframework.org/schema/mvc
  14. http://www.springframework.org/schema/mvc/spring-mvc.xsd
  15. http://www.springframework.org/schema/tx
  16. http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
  17. http://www.springframework.org/schema/util
  18. http://www.springframework.org/schema/util/spring-util.xsd"
  19. default-autowire="byName">
  20. <bean id="baseUtil" class="com.mes.core.BaseUtil"></bean>
  21. <util:properties id="about">
  22. <prop key="defaultSob">MES_ZZ</prop><!-- 默认帐套名称 --><!-- 集团中心名称 -->
  23. <prop key="task.status">true</prop>
  24. </util:properties>
  25. <mvc:resources mapping="/resources/**" location="/resources/" />
  26. <mvc:default-servlet-handler />
  27. <!-- 自动扫描 ,把作了注解的类转换为bean -->
  28. <aop:aspectj-autoproxy />
  29. <context:property-placeholder location="WEB-INF/spring:*.properties" />
  30. <context:component-scan base-package="com" />
  31. <!-- 事务 -->
  32. <tx:annotation-driven />
  33. <bean id="transactionManager"
  34. class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  35. <property name="dataSource" ref="dataSource" />
  36. </bean>
  37. <tx:annotation-driven transaction-manager="transactionManager" />
  38. <!-- 对模型视图名称的解析,在请求时模型视图名称添加前后缀 -->
  39. <bean
  40. class="org.springframework.web.servlet.view.InternalResourceViewResolver"
  41. p:prefix="/jsps/" p:suffix=".jsp"><!-- 指向的页面在jsps目录下,并且为.jsp文件 -->
  42. <property name="order" value="0" />
  43. </bean>
  44. <bean id="jsonHttpMessageConverter"
  45. class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
  46. </bean>
  47. <bean
  48. class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
  49. <property name="messageConverters">
  50. <util:list id="beanList">
  51. <ref bean="jsonHttpMessageConverter" /><!-- spring对list自动转成json的机制 -->
  52. </util:list>
  53. </property>
  54. </bean>
  55. <!-- 国际化 -->
  56. <bean id="messageSource"
  57. class="org.springframework.context.support.ResourceBundleMessageSource">
  58. <property name="basenames">
  59. <list>
  60. <value>i18n/messages</value><!-- 找src下i18n目录下文件名为messages*的所有properties文件 -->
  61. </list>
  62. </property>
  63. <property name="useCodeAsDefaultMessage" value="true" />
  64. </bean>
  65. <!-- Configure the multipart resolver -->
  66. <bean id="multipartResolver"
  67. class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
  68. <!-- one of the properties available; the maximum file size in bytes -->
  69. <property name="maxUploadSize" value="104857600" />
  70. </bean>
  71. <!-- 自定义拦截器 -->
  72. <mvc:interceptors>
  73. <mvc:interceptor>
  74. <mvc:mapping path="/*/**"></mvc:mapping>
  75. <bean class="com.mes.core.interceptor.DbSourceInterceptor"></bean><!-- MultiDataSource Interceptor -->
  76. </mvc:interceptor>
  77. </mvc:interceptors>
  78. <mvc:annotation-driven />
  79. <import resource="db-config.xml" />
  80. </beans>