[英]Using @annotation in Spring AOP
I am using Spring AOP with aspectj-autoproxy. 我正在使用带有Aspectj-autoproxy的Spring AOP。 I use the @Around annotation to intercept certain classes and methods.
我使用@Around批注来拦截某些类和方法。
@Around(value = "@annotation(counter)")
This code should intercept methods annotated with @Counter annotation. 此代码应拦截使用@Counter注释注释的方法。
My question is, does this definition forces scan of all classes in the class path? 我的问题是,此定义是否会强制扫描类路径中的所有类? I am asking because I have a huge project that can suffer several minutes of loading time if all the class path will be scanned.
我问是因为我有一个庞大的项目,如果所有类路径都将被扫描,则可能会花费几分钟的加载时间。
And if the answer is yes, how can I disable he scanning? 如果答案是肯定的,如何禁用他的扫描功能?
它只会扫描定义的Spring bean,因此不会扫描完整的类路径。.此外,应将注释@Counter指定为完全合格的类名,我认为“ counter”不是正确的类名。
使用以下方式限制扫描:
execution(* com.my.package..*.*(..)) && @annotation(counter)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.