AspectJ-无法识别连接点表达式中的注释 [英] AspectJ - Presence of annotation in join point expression not recognized

查看:94
本文介绍了AspectJ-无法识别连接点表达式中的注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的方面之一中,我具有以下方法:

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名称,或使用类似@*..Standardized的模式.

Unless @Standardized annotation is in default package, you need to specify FQN name for your annotation or use a pattern like @*..Standardized.

这篇关于AspectJ-无法识别连接点表达式中的注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆