spring-mvc.xml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc"
  4. xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
  5. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
  6. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
  7. <!-- 自动扫描且只扫描@Controller -->
  8. <context:component-scan base-package="com.xtframe.admin" use-default-filters="false">
  9. <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
  10. </context:component-scan>
  11. <mvc:annotation-driven >
  12. <mvc:message-converters>
  13. <!-- 避免IE执行AJAX时,返回JSON出现下载文件 -->
  14. <bean id="mappingJacksonHttpMessageConverter"
  15. class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
  16. <property name="supportedMediaTypes">
  17. <list>
  18. <value>text/html;charset=UTF-8</value>
  19. </list>
  20. </property>
  21. </bean>
  22. </mvc:message-converters>
  23. </mvc:annotation-driven>
  24. <mvc:view-controller path="/" view-name="redirect:/main" />
  25. <mvc:resources mapping="/favicon.ico" location="/favicon.ico" />
  26. <mvc:resources mapping="/static/**" location="/static/" />
  27. <mvc:default-servlet-handler />
  28. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  29. <property name="prefix" value="/WEB-INF/pages/" />
  30. <property name="suffix" value=".jsp" />
  31. </bean>
  32. <!-- AOP式方法级权限检查 -->
  33. <bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" >
  34. <property name="proxyTargetClass" value="true" />
  35. </bean>
  36. </beans>