applicationContext-servlet.xml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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:mvc="http://www.springframework.org/schema/mvc"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xmlns:util="http://www.springframework.org/schema/util"
  6. xsi:schemaLocation="
  7. http://www.springframework.org/schema/beans
  8. http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
  9. http://www.springframework.org/schema/context
  10. http://www.springframework.org/schema/context/spring-context-3.2.xsd
  11. http://www.springframework.org/schema/util
  12. http://www.springframework.org/schema/util/spring-util-3.2.xsd
  13. http://www.springframework.org/schema/mvc
  14. http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
  15. <context:component-scan base-package="com.tl"
  16. use-default-filters="false">
  17. <context:include-filter type="annotation"
  18. expression="org.springframework.stereotype.Controller" />
  19. </context:component-scan>
  20. <mvc:annotation-driven validator="validator">
  21. <mvc:message-converters>
  22. <bean class="org.springframework.http.converter.StringHttpMessageConverter">
  23. <property name="supportedMediaTypes">
  24. <list>
  25. <value>text/plain;charset=UTF-8</value>
  26. <!-- <value>text/html;charset=UTF-8</value> -->
  27. </list>
  28. </property>
  29. </bean>
  30. </mvc:message-converters>
  31. </mvc:annotation-driven>
  32. <!-- static files/resources not to go through controllers -->
  33. <mvc:resources mapping="/resources/**" location="/resources/" />
  34. <mvc:default-servlet-handler />
  35. <bean id="viewResolver"
  36. class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  37. <property name="viewClass"
  38. value="org.springframework.web.servlet.view.JstlView" />
  39. <property name="prefix" value="/WEB-INF/views/" />
  40. <property name="suffix" value=".jsp" />
  41. </bean>
  42. <!-- Application Message Bundle -->
  43. <bean id="messageSource"
  44. class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
  45. <property name="basenames">
  46. <list>
  47. <value>/WEB-INF/config/platform/messages</value>
  48. </list>
  49. </property>
  50. <property name="cacheSeconds" value="60" />
  51. <property name="defaultEncoding" value="UTF-8"></property>
  52. </bean>
  53. <bean id="validator"
  54. class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
  55. <property name="validationMessageSource" ref="messageSource"></property>
  56. <property name="providerClass" value="org.hibernate.validator.HibernateValidator" />
  57. </bean>
  58. <bean id="multipartResolver"
  59. class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
  60. <property name="maxUploadSize" value="2000000" />
  61. <property name="resolveLazily" value="true"></property>
  62. </bean>
  63. </beans>