springmvc-config.xml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <beans xmlns="http://www.springframework.org/schema/beans"
  2. 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. xsi:schemaLocation="http://www.springframework.org/schema/beans
  6. http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
  7. http://www.springframework.org/schema/context
  8. http://www.springframework.org/schema/context/spring-context-4.0.xsd
  9. http://www.springframework.org/schema/mvc
  10. http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
  11. <!-- scan the package and the sub package -->
  12. <context:component-scan base-package="com.redhat.crowdfunding.controller"/>
  13. <!-- don't handle the static resource -->
  14. <mvc:default-servlet-handler/>
  15. <mvc:resources mapping="/js/**" location="/static/js/"/>
  16. <mvc:resources mapping="/css/**" location="/static/css/"/>
  17. <mvc:resources mapping="/dist/**" location="/static/dist/"/>
  18. <!-- 配置驱动 -->
  19. <mvc:annotation-driven>
  20. <mvc:message-converters>
  21. <bean class="org.springframework.http.converter.StringHttpMessageConverter">
  22. <property name="supportedMediaTypes">
  23. <list>
  24. <value>text/plain;charset=UTF-8</value>
  25. <value>text/html;charset=UTF-8</value>
  26. <value>application/json;charset=UTF-8</value>
  27. </list>
  28. </property>
  29. </bean>
  30. </mvc:message-converters>
  31. </mvc:annotation-driven>
  32. <!-- 配置视图 -->
  33. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" id="internalResourceViewResolver">
  34. <!-- 前缀 -->
  35. <property name="prefix" value="/WEB-INF/jsp/"/>
  36. <!-- 后缀 -->
  37. <property name="suffix" value=".jsp"/>
  38. </bean>
  39. </beans>