
aop
醉死梦红尘丶
学学代码,写写代码
展开
-
SpringBoot中业务缓存的实现
在项目(SpringBoot项目)的启动类上添加@EnableCaching注解,以启动缓存配置。关键代码如下 /* * 异步的自动配置生效). * @EnableCaching 注解表示启动缓存配置 */ @EnableCaching @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.ru原创 2020-08-18 09:06:45 · 230 阅读 · 0 评论 -
springboot-aop事务简介
AOP事务 开启:在springboot启动类上加注解@EnableTransactionManagement 使用:在方法或者类上加注解:@Transactional @Transactional 当这个注解使用在类上意味着这个类中的所有方法都受事务控制,该注解在类上使用定义类中方法共同特性,如有特殊在方法上注解另行加注解 @Transactional( timeout = 30,//超时时间设置 默认单位秒 默认-1 不超时 超时则自动回滚事务。 readOnly = false,//false:原创 2020-08-18 09:07:19 · 251 阅读 · 0 评论 -
aop的通知方法中获取切入点类名参数等
环绕注解和普通注解参数 普通注解参数使用:JoinPoint 环绕注解参数使用:ProceedingJoinPoint //ProceedingJoinPoint jp 为通知方法参数 Object result=jp.proceed();//调用本类内部切入点对应其它通知或其它切面或目标方法。 Method targetMethod=getTargetMethod(jp);//使用自定义方法获取目标方法对象 String targetMethodName= targetMethod.getDeclarin原创 2020-08-17 12:41:00 · 1185 阅读 · 0 评论