Pointcut이 내장되어있는 Advisor
<?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:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.3.xsd">
<!-- main -->
<bean id="target" class="spring.aop.entity.ScoreExam" p:kor="1" p:eng="1" p:math="1" p:com="1"/>
<!-- Advice -->
<bean id="logAroundAdvice" class="spring.aop.advice.LogAroundAdvice"/>
<bean id="logBeforeAdvice" class="spring.aop.advice.LogBeforeAdvice"/>
<bean id="logAfterReturningAdvice" class="spring.aop.advice.LogAfterReturningAdvice"/>
<bean id="logAfterThrowingAdvice" class="spring.aop.advice.LogAfterThrowingAdvice"/>
<!-- use regular expression / this class have pointcut, advisor -->
<bean id="classicBeforeAdvisor" class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
<property name="advice" ref="logBeforeAdvice"/>
<property name="patterns">
<list>
<value>.*to.*</value>
</list>
</property>
</bean>
<bean id="classicAroundAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice" ref="logAroundAdvice"/>
<property name="mappedName" value="total"/>
</bean>
<!-- Proxy -->
<bean id="proxy" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target" ref="target"/>
<property name="interceptorNames">
<list>
<value>classicAroundAdvisor</value>
<value>classicBeforeAdvisor</value>
<value>logAfterReturningAdvice</value>
<value>logAfterThrowingAdvice</value>
</list>
</property>
</bean>
</beans>
728x90
'Spring' 카테고리의 다른 글
Spring Legacy 기본세팅 ( 2 ) (0) | 2023.08.14 |
---|---|
Spring Legacy 기본세팅 ( 1 ) (0) | 2023.08.08 |
Advisor ( 1 ) (0) | 2023.08.08 |
After Returning • Throwing Advice (0) | 2023.08.07 |
BeforeAdvice (0) | 2023.08.07 |