<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
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
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
">
<!--可配置controller层的注解扫描、视图解析器、异常处理器、文件上传解析器、拦截器、哪些资源部拦截、MVC注解驱动-->
<!--1、配置注解扫描,扫描controller-->
<context:component-scan base-package="controller包路径"/>
<!--2、配置视图解析器-->
<bean id="ViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!--JSP文件所在目录-->
<property name="prefix" value="/pages/" />
<!--文件的后缀名-->
<property name="suffix" value=".jsp"/>
</bean>
<!--3、MVC注解驱动,开启对SpringMVC注解的支持-->
<mvc:annotation-driven/>
<!--让映射器、适配器和处理器生效(不配置默认也是生效)-->
<!--<mvc:annotation-driven conversion-service="conversionService"/>-->
<!--4、静态资源权限开放-->
<!-- <mvc:default-servlet-handler/>-->
<!--设置静态资源不过滤-->
<mvc:resources mapping="/css/**" location="/css/"/>
<mvc:resources mapping="/img/**" location="/img/"/>
<mvc:resources mapping="/js/**" location="/js/"/>
<mvc:resources mapping="/plugins/**" location="/plugins/"/>
<!--支持AOP的注解支持,AOP底层使用代理技术
JDK动态代理,要求必须有接口
cglib代理,生成子类对象,proxy-target-class=“true"默认使用cglib的方式
-->
<aop:aspectj-autoproxy proxy-target-class="true"/>
</beans>
贴个文件夹结构,免得搞错了!