Просмотр исходного кода

启动aop注解基于类的代理

shuzheng 9 лет назад
Родитель
Сommit
9a7da834e8
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      zheng-common/src/main/resources/springMVC-servlet.xml

+ 7 - 1
zheng-common/src/main/resources/springMVC-servlet.xml

@@ -3,19 +3,25 @@
 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xmlns:context="http://www.springframework.org/schema/context"
 	xmlns:context="http://www.springframework.org/schema/context"
 	xmlns:mvc="http://www.springframework.org/schema/mvc"
 	xmlns:mvc="http://www.springframework.org/schema/mvc"
+	xmlns:aop="http://www.springframework.org/schema/aop"
 	xsi:schemaLocation="
 	xsi:schemaLocation="
         http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/context 
         http://www.springframework.org/schema/context 
         http://www.springframework.org/schema/context/spring-context.xsd
         http://www.springframework.org/schema/context/spring-context.xsd
         http://www.springframework.org/schema/mvc
         http://www.springframework.org/schema/mvc
-        http://www.springframework.org/schema/mvc/spring-mvc.xsd">
+        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 -->
 	<!-- 扫描controller -->
 	<context:component-scan base-package="**.*controller" />
 	<context:component-scan base-package="**.*controller" />
 	<context:annotation-config />
 	<context:annotation-config />
 	<bean id="swagger2Config" class="springfox.documentation.swagger2.configuration.Swagger2DocumentationConfiguration"/>
 	<bean id="swagger2Config" class="springfox.documentation.swagger2.configuration.Swagger2DocumentationConfiguration"/>
 
 
+	<!-- 启动aop注解基于类的代理(这时需要cglib库),如果proxy-target-class属值被设置为false或者这个属性被省略,那么标准的JDK 基于接口的代理将起作用 -->
+	<aop:config proxy-target-class="true"/>
+
 	<!-- 返回ResponseBody响应类型 -->
 	<!-- 返回ResponseBody响应类型 -->
 	<mvc:annotation-driven>
 	<mvc:annotation-driven>
 		<mvc:message-converters>
 		<mvc:message-converters>