spring-mvc-config.xml 1.5 KB

123456789101112131415161718192021222324252627282930
  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 http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
  6. <mvc:default-servlet-handler/>
  7. <!-- 自动注入(@Component、@Repository、@Service、@Controller) -->
  8. <context:component-scan base-package="com.biaoge.controller" />
  9. <!-- 注解驱动 -->
  10. <mvc:annotation-driven>
  11. <mvc:message-converters register-defaults="true">
  12. <bean class="org.springframework.http.converter.StringHttpMessageConverter">
  13. <property name="supportedMediaTypes" value="text/html;charset=UTF-8"/>
  14. </bean>
  15. </mvc:message-converters>
  16. </mvc:annotation-driven>
  17. <!-- 静态资源配置 -->
  18. <mvc:resources mapping="/assets/**" location="/assets/"/>
  19. <!-- 对模型视图名称的解析,即在模型视图名称添加前后缀 -->
  20. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  21. <property name="prefix" value="/"/>
  22. <property name="suffix" value=".jsp"/>
  23. </bean>
  24. </beans>