mybatis-servlet.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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:context="http://www.springframework.org/schema/context"
  4. xmlns:mvc="http://www.springframework.org/schema/mvc"
  5. xsi:schemaLocation="http://www.springframework.org/schema/beans
  6. http://www.springframework.org/schema/beans/spring-beans.xsd
  7. http://www.springframework.org/schema/mvc
  8. http://www.springframework.org/schema/mvc/spring-mvc.xsd
  9. http://www.springframework.org/schema/context
  10. http://www.springframework.org/schema/context/spring-context.xsd">
  11. <mvc:default-servlet-handler />
  12. <!--RequestMappingHandlerAdapter -->
  13. <mvc:annotation-driven>
  14. <mvc:message-converters>
  15. <ref bean="stringHttpMessageConverter" />
  16. <ref bean="marshallingHttpMessageConverter" />
  17. <ref bean="mappingJackson2HttpMessageConverter" />
  18. </mvc:message-converters>
  19. </mvc:annotation-driven>
  20. <context:component-scan base-package="com.yc.education.controller.demo" />
  21. <context:component-scan base-package="com.yc.education.controller" />
  22. <context:component-scan base-package="com.yc.education.interceptor" />
  23. <!-- 全局拦截器配置文件 Start -->
  24. <!-- <mvc:interceptors>
  25. <mvc:interceptor>
  26. <mvc:mapping path="/list.html" />
  27. <mvc:mapping path="/product.html" />
  28. <mvc:mapping path="/updatehis.html" />
  29. <mvc:mapping path="/search.html" />
  30. <mvc:mapping path="/deleteByuid.html" />
  31. <mvc:mapping path="/isend.html" />
  32. <mvc:mapping path="/getconfig.html.html" />
  33. <mvc:exclude-mapping path="/"/>
  34. <mvc:exclude-mapping path="/index.html"/>
  35. <mvc:exclude-mapping path="/index"/>
  36. <mvc:exclude-mapping path="/findaccess_token"/>
  37. <mvc:exclude-mapping path="/admin/**"/>
  38. <mvc:exclude-mapping path="/**/*.css"/>
  39. <mvc:exclude-mapping path="/**/*.eot"/>
  40. <mvc:exclude-mapping path="/**/*.svg"/>
  41. <mvc:exclude-mapping path="/**/*.ttf"/>
  42. <mvc:exclude-mapping path="/**/*.woff"/>
  43. <mvc:exclude-mapping path="/**/*.js"/>
  44. <mvc:exclude-mapping path="/**/*.png"/>
  45. <mvc:exclude-mapping path="/**/*.gif"/>
  46. <mvc:exclude-mapping path="/**/*.jpg"/>
  47. <bean class="com.yc.education.interceptor.GlobalInterceptor" />
  48. </mvc:interceptor>
  49. </mvc:interceptors> -->
  50. <!-- 全局拦截器配置文件 End -->
  51. <bean id="stringHttpMessageConverter"
  52. class="org.springframework.http.converter.StringHttpMessageConverter" />
  53. <bean id="marshallingHttpMessageConverter"
  54. class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
  55. <property name="marshaller" ref="castorMarshaller" />
  56. <property name="unmarshaller" ref="castorMarshaller" />
  57. </bean>
  58. <bean id="mappingJackson2HttpMessageConverter"
  59. class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
  60. <property name="supportedMediaTypes">
  61. <list>
  62. <value>application/json</value>
  63. <value>application/xml</value>
  64. <value>text/html</value>
  65. <value>text/plain</value>
  66. <value>text/xml</value>
  67. </list>
  68. </property>
  69. </bean>
  70. <bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller" />
  71. <!--信息转换 - 结束 -->
  72. <bean id="contentNegotiationManagerFactoryBean"
  73. class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
  74. <property name="defaultContentType" value="text/html" />
  75. <property name="ignoreAcceptHeader" value="true" />
  76. <property name="favorPathExtension" value="true" />
  77. <property name="favorParameter" value="false" />
  78. <property name="mediaTypes">
  79. <map>
  80. <entry key="atom" value="application/atom+xml" />
  81. <entry key="html" value="text/html" />
  82. <entry key="json" value="application/json" />
  83. </map>
  84. </property>
  85. </bean>
  86. <!--内容协商 -->
  87. <bean
  88. class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
  89. <property name="contentNegotiationManager">
  90. <bean
  91. class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
  92. <property name="defaultContentType" value="text/html" />
  93. <property name="mediaTypes">
  94. <map>
  95. <entry key="json" value="application/json" />
  96. <entry key="xml" value="application/xml" />
  97. <entry key="html" value="text/html" />
  98. </map>
  99. </property>
  100. </bean>
  101. </property>
  102. <property name="viewResolvers">
  103. <list>
  104. <bean
  105. class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  106. <property name="prefix" value="/" />
  107. <property name="suffix" value=".jsp" />
  108. </bean>
  109. </list>
  110. </property>
  111. <property name="defaultViews">
  112. <list>
  113. <bean
  114. class="org.springframework.web.servlet.view.json.MappingJackson2JsonView" />
  115. <bean class="org.springframework.web.servlet.view.xml.MarshallingView">
  116. <property name="marshaller" ref="castorMarshaller" />
  117. </bean>
  118. </list>
  119. </property>
  120. </bean>
  121. <!--国际化 -->
  122. <bean id="messageSource"
  123. class="org.springframework.context.support.ResourceBundleMessageSource">
  124. <property name="defaultEncoding" value="UTF-8" />
  125. <property name="basenames">
  126. <list>
  127. <value>messages.welcome</value>
  128. </list>
  129. </property>
  130. </bean>
  131. <!--文件上传 -->
  132. <bean id="multipartResolver"
  133. class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
  134. <property name="maxUploadSize" value="100000000" />
  135. </bean>
  136. </beans>