aop advice root-context servlet-context 차이점
-
AOP 설정을 root-context 와 servlet-context 에 했을 때의 차이점스프링 2016. 8. 8. 21:51
AOP 적용을 위해 구현한 Advice 를 component-scan 을 통해 불러와야 한다. component-scan 은 root-context 와 servlet-context 에 할 수 있는데, 위 두 context 간 계층이 존재하기 때문에 설정시 주의해야 한다. 1. root-context 에서 scan 하여 추가된 component 는 servlet-context 에서 scan 하여 추가된 component 를 사용할 수 있다. 2. 반대로 servlet-context 에서 추가된 component 는 root-context 에서 추가된 component 를 사용할 수 없다. 따라서 아래와 같은 상황에서는 Advice 를 정의한 package 인 com.repacat.aop 를 root-con..