안녕하세요 스프링 aop를 적용 해보려고 하는데요 문제점이
생겨서 죄송하지만 질문이 있습니다..
<!-- AOP 대상 맵핑 클래스 -->
<bean id="testAspect" class="com.aop.Test" />
<!-- 나의 포인트컷 -->
<!-- 테스트 스캐너 : execution(public * com.controller.*.*(..))
.*handleRequest.* //접근제한자 퍼블릭에 리턴타입 모두포함 패키지 그다음 클래스 그다음 메소드갯수 제한없음 -->
<aop:config>
<aop:pointcut
expression="execution(public * com.controller.*.*(..))"
id="myPointcut" />
</aop:config>
<!-- AOP 2순위 -->
<aop:config>
<aop:aspect id="test2" ref="testAspect" order="0">
<!--시작전 -->
<aop:before pointcut-ref="myPointcut" method="myBefore" />
<!-- 시작후 정상시 -->
<aop:after-returning pointcut-ref="myPointcut"
method="myAfterTuning" />
<!-- 시작후 예외시 -->
<aop:after-throwing pointcut-ref="myPointcut"
method="myAfterThrow" />
<!-- 시작후 무조건적 예외포함 -->
<aop:after pointcut-ref="myPointcut" method="myAfter" />
<!-- 시작 전/후 모두 -->
<aop:around pointcut-ref="myPointcut" method="myAround" />
</aop:aspect>
</aop:config>
<!-- AOP 대상 맵핑 클래스 -->
<aop:config>
<aop:pointcut expression=".*handleRequest.*" id="mySimplePointcut" />
</aop:config>
Aop관련.java
@Aspect
public class Test {
private TestService testService;
@Autowired
public void setTestService(TestService testService) {
this.testService = testService;
}
@Before(value = "")
public void myBefore() {
System.out.println("myBefore");
}
@AfterReturning
public void myAfterReturning() {
System.out.println("myAfterReturning");
}
@AfterThrowing
public void myAfterThrowing() {
System.out.println("myAfterThrowing");
}
@After(value = "")
public void myAfter() {
System.out.println("myAfter");
}
@Around(value = "")
public void myAround() {
System.out.println("myAround");
}
@Pointcut
public void myPointcut() {
System.out.println("myPointcut");
}
}
그리고 궁금한게 저렇게 한다고 치면
HttpServletRequest 는 어떻게 사용하나요?
인터넷보고 이것저것 설정해봤는데 잘 안되네요..뭐가 문제일까요.
--
Google 그룹스 'Korea Spring User Group' 그룹에 가입했으므로 본 메일이 전송되었습니다.
웹에서 이 토론을 보려면
https://groups.google.com/d/msg/ksug/-/d8Nyhyi7kmcJ을(를) 방문하세요.
이 그룹에 게시하려면
ks...@googlegroups.com(으)로 이메일을 보내세요.
그룹에서 탈퇴하려면
ksug+uns...@googlegroups.com로 이메일을 보내주세요.
더 많은 옵션을 보려면
http://groups.google.com/group/ksug?hl=ko에서 그룹을 방문하세요.