<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> <description>Spring-web MVC配置</description> <mvc:annotation-driven /> <context:component-scan base-package="com.xxl.controller" /> <mvc:resources mapping="/favicon.ico" location="/favicon.ico" /> <mvc:resources mapping="/static/**" location="/static/" /> <bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.freemarker.FreeMarkerView" /> <!-- 解析视图模板类 --> <property name="prefix" value="" /> <!-- 模板前后缀,指定html页面为模板 --> <property name="suffix" value=".ftl" /> <property name="contentType" value="text/html;charset=UTF-8" /> <!-- 模板输出内容编码 (此处应与defaultEncoding保持一致) --> <property name="exposeSpringMacroHelpers" value="true" /> <!-- 访问Request/Session宏助手 --> <property name="exposeRequestAttributes" value="true" /> <!-- 允许访问Request属性,默认为false --> <property name="exposeSessionAttributes" value="true" /> <!-- 允许访问Session属性,默认为false --> <property name="requestContextAttribute" value="request" /> <!-- 将HttpServletRequest的属性存放到request这个变量中 --> <property name="cache" value="true" /> <property name="order" value="0" /> </bean> <!-- <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/**"/> <bean class="com.xxl.controller.interceptor.PermissionInterceptor"/> </mvc:interceptor> </mvc:interceptors> <bean id="exceptionResolver" class="com.xxl.controller.resolver.WebExceptionResolver" /> --> </beans>