import org.aspectj.lang.annotation.After; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; /** * @Author Kent Lee * 2018/7/31 */ @Aspect @Component public class HttpAspect { private final static Logger logger = LoggerFactory.getLogger(HttpAspect.class); @Pointcut("execution(public * com.rz.controller.GirlController.*(..))") public void log(){} @Before("log()") public void doBefore(){ logger.info("111111"); } @After("log()") public void doAfter(){ logger.info("222222"); } }
原文地址:https://www.cnblogs.com/RzCong/p/9397445.html
时间: 2024-11-03 14:46:59