<aop:config>
<aop:aspect ref="audience">
<aop:before pointcut="execution(* com.springinaction.springidol.Performer.perform(..))" method="takeSeats"/>
<aop:before pointcut="execution(* com.springinaction.springidol.Performer.perform(..))" method="turnOffCellPhones"/>
<aop:after-returning pointcut="execution(* com.springinaction.springidol.Performer.perform(..))" method="applaud"/>
<aop:after-throwing pointcut="execution(* com.springinaction.springidol.Performer.perform(..))" method="demandRefund"/>
</aop:aspect>
</aop:config>
<aop:config>
<aop:aspect ref="audience">
<aop:pointcut id="performance" expression="execution(* com.springinaction.springidol.Performer.perform(..))"/>
<aop:before pointcut-ref="performance" method="takeSeats"/>
<aop:before pointcut-ref="performance" method="turnOffCellPhones"/>
<aop:after-returning pointcut-ref="performance" method="applaud"/>
<aop:after-throwing pointcut-ref="performance" method="demandRefund"/>
</aop:aspect>
</aop:config>
<bean id="audience" class="com.springinactin.springidol.Audience"/>
public class Audience{
//공연 전
public void takeSeats(){
}
//공연 전
public void turnOffCellPhones(){
}
//공연 후
public void applaud(){
}
//공연 실패 후
public void demandRefund(){
}
}
@Aspect
public class Audience{
@Point("execution(* com.springinaction.springidol.Performer.perform(..))")
public void performance(){}
@Before("performance()")
//공연 전
public void takeSeats(){
}
@Before("performance()")
//공연 전
public void turnOffCellPhones(){
}
@AfterReturning("performance()")
//공연 후
public void applaud(){
}
@AfterThrowing("performance()")
//공연 실패 후
public void demandRefund(){
}
}