【发布时间】:2018-02-01 10:47:20
【问题描述】:
我有这样的实体类:
package tr.com.example.model.porting
...//omitting imports
@Configurable
@Data
@Entity
public class PortOut{
public void handleRequest(Long portingId) {
processRequest(portingId);
...
}
}
这是我在不同类中使用@Aspect 和@Component 注释的方面代码:
@Around("execution(* tr.com.example..PortOut.handleRequest(..))")
public void handlePortingProcessAdvice(ProceedingJoinPoint joinPoint) throws Throwable {
joinPoint.proceed();
log.debug(log.debug("[POM]:{} is executed with parameters:{}", joinPoint.toShortString(), joinPoint.getArgs()))
}
通常,我的方面代码可以正常工作,用于其他 Spring 托管类,例如使用 @Service、@Component 注释。我使用https://github.com/subes/invesdwin-instrument 作为织布代理,还使用Lombok。
我尝试了this 链接(以及其他这样的帖子)。但是由于我使用的是 Lombok,所以我无法使用 aspectj 编译器直接编译以编织 @Configurable 类,因此我发现它不适用于 Lombok。 https://groups.google.com/forum/#!topic/project-lombok/ZkLsTZVSgD4
简而言之,我想要的是使用 aspectj 来记录一些方法的参数,但我不能在任何 Hibernate 实体类中使用它,除了它可以正常工作。如何让它在实体类中工作?
【问题讨论】:
标签: spring hibernate spring-boot aspectj spring-aop