Time: 2024-05-16 Thursday 11:02:01
Author: Jackasher
Spring Aop.xml
比较完整的spring.xml文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 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/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
<bean id="logAspect" class="org.example.service.LogAspect"></bean> <bean id="userService" class="org.example.service.UserService"></bean>
<aop:config> <aop:pointcut id="myPointCut" expression="execution (* org.example.service.UserService.*(..))"/> <aop:aspect ref="logAspect"> <aop:around method="aroundAdvice" pointcut-ref="myPointCut"></aop:around> </aop:aspect> </aop:config>
</beans>
|