<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" 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-2.5.xsd"> <!-- 配置Advice --> <bean id="LogAdvice" class="com.company.LogAdvice" /> <!-- 配置代理 --> <!--bean id="testService" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="target"> <bean class="com.company.TestServiceImpl" /> </property> <property name="proxyInterfaces"> <value>com.company.ITestService</value> </property> <property name="interceptorNames"> <list> <value>LogAdvice</value> </list> </property> </bean--> <!-- 配置bean --> <bean id="testService" class="com.company.TestServiceImpl"></bean> <!-- 配置自动代理 --> <bean id="beanNameAutoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="beanNames"> <list> <value>*</value> </list> </property> <property name="interceptorNames"> <value>LogAdvice</value> </property> </bean> </beans>
spring拦截器配置
最新推荐文章于 2022-08-02 20:13:11 发布