1. <?xml version="1.0" encoding="UTF-8"?>
    2. <beans xmlns="http://www.springframework.org/schema/beans"
    3. xmlns:mvc="http://www.springframework.org/schema/mvc"
    4. xmlns:context="http://www.springframework.org/schema/context"
    5. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    6. xmlns:aop="http://www.springframework.org/schema/aop"
    7. xsi:schemaLocation="
    8. http://www.springframework.org/schema/beans
    9. http://www.springframework.org/schema/beans/spring-beans.xsd
    10. http://www.springframework.org/schema/mvc
    11. http://www.springframework.org/schema/mvc/spring-mvc.xsd
    12. http://www.springframework.org/schema/context
    13. http://www.springframework.org/schema/context/spring-context.xsd
    14. http://www.springframework.org/schema/aop
    15. http://www.springframework.org/schema/aop/spring-aop.xsd
    16. ">
    17. <!-- 扫描controller的注解,别的不扫描 -->
    18. <context:component-scan base-package="com.deya.controller">
    19. </context:component-scan>
    20. <!-- 配置视图解析器 -->
    21. <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    22. <!-- JSP文件所在的目录 -->
    23. <property name="prefix" value="/pages/" />
    24. <!-- 文件的后缀名 -->
    25. <property name="suffix" value=".jsp" />
    26. </bean>
    27. <!-- 设置静态资源不过滤 -->
    28. <mvc:resources location="/css/" mapping="/css/**" />
    29. <mvc:resources location="/img/" mapping="/img/**" />
    30. <mvc:resources location="/js/" mapping="/js/**" />
    31. <mvc:resources location="/plugins/" mapping="/plugins/**" />
    32. <!-- 开启对SpringMVC注解的支持 -->
    33. <mvc:annotation-driven />
    34. <!--
    35. 支持AOP的注解支持,AOP底层使用代理技术
    36. JDK动态代理,要求必须有接口
    37. cglib代理,生成子类对象,proxy-target-class="true" 默认使用cglib的方式
    38. -->
    39. <aop:aspectj-autoproxy proxy-target-class="true"/>
    40. </beans>