Here is my code:
Controller class
@controller
public class TrendController extends MyController{
@RequestMapping(method= RequestMethod.POST, value = "/trend")
public ModelAndView myReq(@RequestBody body, HttpHeaders hdr){
return super.myReq(body,hdr)
}
}
MyController class
public abstract class MyController implements ApplicationContextAware{
protected ModelAndView myReq(@RequestBody body, HttpHeaders hdr){
MyReqType req = null;
req = unmrsl(body,hdr);
}
protected MyReqType unmrsl(@RequestBody body, HttpHeaders hdr){
MyReqType request = null;
.
.
.
return request;
}
}
AOP Configuration:
I've added my pointcut expression in myReq.xml
<bean id="myAspect" class = com.abc.xyz.aop.myInterceptor/>
<aop:config>
<aop:aspect ref="myAspect">
<aop pointcut id="myPrReq"
expression="execution(* com.abc.xyz.controllers.MyController.unmrsl(..)"/>
<aop:after pointcut-ref="myPrReq" method="myTestMthd"/>
Now.. I've written myTestMthd in com.abc.xyz.aop.myInterceptor.Java , and it suppose to hit my logic in myTestMthd after execution of unmrsl method in MyController. But it is not working as expected.
com.abc.xyz.aop.myInterceptor.Java
public class myInterceptor{
public void myTestMthd(JoinPoint call){
.
.
mylogic
.
.
}
}