欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Aspect Pointcut 多路径配置

程序员文章站 2022-06-01 10:29:34
...

配置如下:

@Pointcut("execution(* com.zit.itmp.monitorinfo.service.*.save*(..))"
			+ "||execution(* com.zit.itmp.monitorinfo.service.*.delete*(..))"
			+ "||execution(* com.zit.itmp.monitorinfo.service.*.update*(..))")  
	public void addUpdateDelServiceCall() { 
	}  

Aspect完整配置,如下:

@Aspect
@Component
public class UpdateMonitorInfoCacheAspect {
	
	
	@Pointcut("execution(* com.zit.itmp.monitorinfo.service.*.save*(..))"
			+ "||execution(* com.zit.itmp.monitorinfo.service.*.delete*(..))"
			+ "||execution(* com.zit.itmp.monitorinfo.service.*.update*(..))")  
	public void addUpdateDelServiceCall() { 
	}  
	
   
    @AfterReturning(value="addUpdateDelServiceCall()", argNames="rtv", returning="rtv")  
    public void insertServiceCallCalls(JoinPoint joinPoint, Object rtv) throws Throwable{
    	new Thread(()->{ 
    		MonitorInfoCache.INSTANCE.loadRefresh(); 
    		}).start();
    }  
	
}