问题描述
在我的一个方面,我有以下方法:
In one of my aspects i have the following method:
@Before("execution (* org.xx.xx.xx..*.*(@Standardized (*),..))")
public void standardize(JoinPoint jp) throws Throwable {
}
目标是找到我的应用程序包的所有方法,这些方法至少有一个用@Standardized 注释的参数(不是用@Standardized 注释的类型不同)
The goal is to find all methods of my application packages which have at least one parameter annotated with @Standardized (not with a type annotated with @Standardized which is different)
ps:@Standardized 是自定义注解.
ps: @Standardized is a custom annotation.
从我在文档中读到的内容来看,此配置应该是正确的(如果不是,请告诉我),但是当我在 JBoss 服务器下部署我的应用程序时,出现以下异常:
From what i've read on the documentation, this configuration should be the correct one (let me know if not), but when i deploy my application under a JBoss server, i have the following exception:
java.lang.IllegalArgumentException:警告不匹配此类型名称:标准化
java.lang.IllegalArgumentException: warning no match for this type name: Standardized
详情:
11.05.12 17:02:35 ERROR - ContextLoader.java@initWebApplicationContext: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: warning no match for this type name: Standardized [Xlint:invalidAbsoluteTypeName]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
我尝试使用 (@Standardized *,..) 而不是 (@Standardized (*),..) (这不会产生我所知道的相同结果),但我仍然遇到相同的错误.
I tried with (@Standardized *,..) instead of (@Standardized (*),..) (which would not have the same result i know) but i still have the same error.
有人知道为什么吗?
在此先感谢您的帮助.
问候.
推荐答案
除非 @Standardized
注释在默认包中,否则您需要为注释指定 FQN 名称或使用类似 的模式@*..标准化
.
Unless @Standardized
annotation is in default package, you need to specify FQN name for your annotation or use a pattern like @*..Standardized
.
这篇关于AspectJ - 无法识别连接点表达式中的注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!