2013-04-23 116 views
0

我正在使用Spring AOP和aspectj-autoproxy。 我使用@Around注释来截取某些类和方法。在Spring AOP中使用@annotation

@Around(value = "@annotation(counter)") 

该代码应拦截使用@Counter批注注释的方法。

我的问题是,这个定义是否强制扫描类路径中的所有类? 我在问,因为我有一个巨大的项目,如果所有的课程路径都将被扫描,可能会有几分钟的加载时间。

如果答案是肯定的,我该如何禁用他的扫描?

回答

0

它只会扫描定义的Spring bean,因此不会是完整的类路径。另外,注解@Counter应该被指定为完全合格的类名,并且我不认为“counter”是正确的..

0

限制扫描使用:

execution(* com.my.package..*.*(..)) && @annotation(counter)