面向切面可以解决的问题
1.在controller中添加日志用来记录用户的操作记录
2.在调用mybatis的时候,可能会抛出运行时异常,可以自定义注解捕获运行时异常
3.可以对用户权限进行校验
4.给dubbo的controller的RpcContext.getContext()放置属性在service中获取
a.自定义注解
@Target({ ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Test
{
String key() default "";
String value() default "";
}
b.面向切面获取该注解
c.在需要的方法上声明该注解