applicationContext-mvc.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xmlns:context="http://www.springframework.org/schema/context"
  4. xmlns:mvc="http://www.springframework.org/schema/mvc"
  5. xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"
  6. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
  7. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
  8. http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"
  9. default-lazy-init="true">
  10. <context:property-placeholder location="classpath*:/system.properties" ignore-resource-not-found="true"
  11. ignore-unresolvable="true"/>
  12. <context:component-scan base-package="com.hboxs" use-default-filters="false">
  13. <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
  14. </context:component-scan>
  15. <!-- aop -->
  16. <aop:aspectj-autoproxy/>
  17. <mvc:annotation-driven validator="validator" content-negotiation-manager="contentNegotiationManager"/>
  18. <bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
  19. <property name="favorPathExtension" value="false"/>
  20. <property name="favorParameter" value="false"/>
  21. <property name="ignoreAcceptHeader" value="false"/>
  22. <property name="mediaTypes">
  23. <value>
  24. atom=application/atom+xml
  25. html=text/html
  26. json=application/json
  27. *=*/*
  28. </value>
  29. </property>
  30. </bean>
  31. <mvc:interceptors>
  32. <mvc:interceptor>
  33. <mvc:mapping path="/**"/>
  34. <bean id="openSessionInViewInterceptor"
  35. class="org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor">
  36. <property name="entityManagerFactory" ref="entityManagerFactory"/>
  37. </bean>
  38. </mvc:interceptor>
  39. <mvc:interceptor>
  40. <mvc:mapping path="/asl-admin/**"/>
  41. <bean id="webContentInterceptor" class="org.springframework.web.servlet.mvc.WebContentInterceptor">
  42. <property name="cacheSeconds" value="0"/>
  43. </bean>
  44. </mvc:interceptor>
  45. <mvc:interceptor>
  46. <mvc:mapping path="/asl-admin/**"/>
  47. <bean id="listInterceptor" class="com.hboxs.common.interceptor.ListInterceptor"/>
  48. </mvc:interceptor>
  49. </mvc:interceptors>
  50. <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
  51. <property name="validationMessageSource" ref="messageSource"/>
  52. </bean>
  53. <bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
  54. <property name="viewClass" value="org.springframework.web.servlet.view.freemarker.FreeMarkerView"/>
  55. <property name="suffix" value="${template.suffix}"/>
  56. <property name="contentType" value="text/html; charset=UTF-8"/>
  57. <property name="exposeRequestAttributes" value="true"/>
  58. <property name="exposeSessionAttributes" value="true"/>
  59. <property name="exposeSpringMacroHelpers" value="true"/>
  60. <property name="requestContextAttribute" value="request"/>
  61. <property name="cache" value="true"/>
  62. <property name="order" value="0"/>
  63. </bean>
  64. <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
  65. <property name="defaultEncoding" value="utf-8"/>
  66. </bean>
  67. <bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
  68. <property name="defaultErrorView" value="asl/common/error"/>
  69. </bean>
  70. </beans>