aop 注解应用

@Aspect
@Component
public class ReturnJsonAspect {

        @Pointcut("execution(* com.mysql.*.*.controller..*.*(..)) && @annotation(com.mysoft.common.annotation.ReturnJsonAnnotation)")
	public void controllerAspect() {
		System.out.println(22);
		
	}

	@Before("controllerAspect()")
	public void testBefore(JoinPoint point) {
		try {
			Map<String, String> map = getMethodDescription(point);
			ReturnContextHolder.set(map.get("value"));
			ReturnContextHolder.setFunctionName(map.get("functionName"));
		} catch (Exception e) {
		}
	}
	
	@After("controllerAspect()")
	public void testAfter(JoinPoint point) {
        }

猜你喜欢

转载自ln-software.iteye.com/blog/2369573