Spring之mvc應用(包含aop)
一、使用依賴
<!--1。mysql 5.1.38--> <!--2. mybatis 3.4.6--> <!--3。spring整合mb:spring-context 5.2.6--> <!-- spring-jdbc 5.2.6--> <!-- mybatis-spring 2.0.3--> <!--4. mvc使用的 spring-web 5.2.6--> <!-- spring-mvc 5.2.6--> <!-- 5.數據傳輸格式jackson-databind 2.11.0--> <!-- ackson-core 2.11.0--> <!-- 6. servlet 3.1.0--> <!-- 7. aop需要的:aop-aspect-runtime 1.9.4 --> <!-- aop-aspect-weaver 1.9.4 --> <!-- 8.日志需要的:log4j 1.2.17 -->
二、目錄
三、spring-mvc.xml
<?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:aop="http://www.springframework.org/schema/aop" 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.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 "> <context:component-scan base-package="control"/> <context:annotation-config/> <mvc:annotation-driven/>
<bean class="com.fasterxml.jackson.databind.ObjectMapper"/> <aop:aspectj-autoproxy/> <!--依赖倒置 DI--> <!--切面编程--> <!--拦截器--> </beans>