我创建了一个自定义注释:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ValidateBeforeBuild {
}
方面如下:
@Aspect
@Component
public class AspectForBuildInBuilders {
private static final Logger LOGGER = LoggerFactory.getLogger(AspectForBuildInBuilders.class);
@Before("@annotation(validateBeforeBuild )")
public void validateBusinessModelAdvice(JoinPoint jp, ValidateBeforeBuild validateBeforeBuild ) throws Throwable {
LOGGER.info("Executing class: {}", jp);
}
}
我有一个标有上述注释的build()
。当我尝试拨打build()
时,我没有收到validateBusinessModelAdvice()
的日志消息。我在其中一个配置类中也有@EnableAspectJAutoProxy
。我错过了什么吗?是否还需要更多信息?
答案 0 :(得分:0)
您将注释定义为library(gridExtra)
library(grid)
pf = function(data, xrng=range(df$x), yrng=range(df$y)) {
ggplot(data, aes(x,y)) +
geom_point(size=3) +
facet_wrap(~ factor(group, rev(group))) +
scale_y_continuous(limits=yrng) +
scale_x_continuous(limits=xrng)
}
grid.arrange(pf(df[1:3,]),
arrangeGrob(pf(data.frame(x=-10,y=-10, group="x")) +
theme(panel.border=element_blank(),
panel.background=element_blank(),
strip.background=element_rect(colour=NA, fill=NA),
strip.text=element_text(colour=NA),
axis.text.x=element_text(colour=NA),
axis.title.x=element_text(colour=NA),
axis.ticks.x=element_blank(),
axis.title.y=element_text(angle=90, vjust=0.5),
axis.text.y=element_text(angle=0),
axis.ticks.y=element_line()),
pf(df[4:5,]) + theme(axis.text.y=element_blank(),
axis.title.y=element_blank(),
axis.ticks.y=element_blank()) ,
widths=c(1.12,2)),
ncol=1)
,并在您指定的方面ValidateBeforeBuild
(注意注释中的上方validateBeforeBuild
)
尝试更改
V
的
@Before("@annotation(validateBeforeBuild)")