我有一个带有to方法的Spring控制器:
@RequestMapping(value = "/method1", method = GET)
public A method1() throws Exception
{
return new A();
}和
@RequestMapping(value = "/method2", method = GET)
public int method2() throws Exception
{
return -1;
}我想用一个方面来拦截这些方法:
@Before("execution(** com.test.controller.*(..))")
public void startLog()
{
System.out.println("START");
}这个方面在method1中正常工作,在method2中失败。我做错什么了?
发布于 2015-12-15 10:49:08
具有@RequestMapping注释的特定包中方法的切入点表达式:
@Before("execution(* com.test.controller.*.*(..)) && @annotation(org.springframework.web.bind.annotation.RequestMapping)")
public void startLog()
{
System.out.println("START");
}https://stackoverflow.com/questions/34286720
复制相似问题