<aop:pointcut> 태그와 각 Advice 설정 태그의 pointcut-ref 속성을 이용해서 Pointcut을 설정하고 여러 Advice에서 동일한 Pointcut을 참조
FaqBoardImpl.java
package sp.aop.service; import org.springframework.stereotype.Component;
@Component("faqBoard") @Override @Override |
NoticeBoardImpl.java
package sp.aop.service; import org.springframework.stereotype.Component;
@Component("noticeBoard") @Override @Override |
BoardController.java
package sp.aop.controller; import javax.annotation.Resource; import org.springframework.web.servlet.ModelAndView; import sp.aop.service.Board;
public class BoardController extends
@Resource(name="noticeBoard") } |
LogAdvice.java
package sp.aop.advice; import org.aspectj.lang.JoinPoint;
public class LogAdvice {
public Object logPrint(ProceedingJoinPoint joinPoint) throws Throwable{ |
spring302-servlet.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" <context:annotation-config/> <aop:after pointcut-ref="checkLog" method="afterFinally"/> </beans> |
결과
<<===== START =====>> ***** START *****
|
[참고자료] Spring 3.0 프로그래밍-최범균
'프로그램 > Spring 3.0' 카테고리의 다른 글
@Aspect 어노테이션을 이용한 AOP - @Before, @AfterReturning (0) | 2012.05.09 |
---|---|
@Aspect 어노테이션을 이용한 AOP (0) | 2012.05.09 |
Advice 타입 별 클래스 작성 <aop:after>, <aop:around> (0) | 2012.05.05 |
Advice 타입 별 클래스 작성 <aop:after-throwing> (0) | 2012.05.05 |
Advice 타입 별 클래스 작성 <aop:before>, <aop:after-returning> (0) | 2012.05.03 |