我在定义自己的方面时遇到了一些问题。我有一堆想要剖析get方法的实体,因此我编写了以下切入点和方法
@Pointcut("execution(* tld.myproject.data.entities.*.get*()") public void getEntityProperty() {} @Around("getEntityProperty()") public Object profileGetEntityProperty(ProceedingJoinPoint pjp) throws Throwable { long start = System.currentTimeMillis(); String name = pjp.getSignature().getName(); Object output = pjp.proceed(); long elapsedTime = System.currentTimeMillis() - start; if(elapsedTime > 100) System.err.println("profileGetEntityProperty: Entity method " + name + " execution time: " + elapsedTime + " ms."); return output; }
我已经在配置中启用了编织功能,并且编织到业务层的各个方面都可以正常工作。我的切入点书写正确吗?还是关于实体使它们不可编织?(我的实体在类定义之前以@Entity开头)