Spring Boot 自定義Controller切面日記攔截
阿新 • • 發佈:2021-01-26
技術標籤:springbootjavaThreadjava反射
@Retention(RetentionPolicy.RUNTIME)//註解會在class中存在,執行時可通過反射獲取
@Target(ElementType.METHOD)//目標是方法
@Documented//文件生成時,該註解將被包含在javadoc中,可去掉
public @interface Logger {
/**
* 模組名字
*/
String name() default "";
/**
*方法
*/
String methods ();
}
/**
* 匹配controller層的方法
*/
@Pointcut( value = "@annotation(com.yaoyanshe.masterdata.framework.filter.Logger)")
private void controllerPointcut() {
}
@Logger(modelName = "CompanyDescribeController",option = "find")
@RequestMapping(value = "find", method = RequestMethod.POST)
public BaseApiResponse<Obejct> find(
return null;
)