warning no match for this type name:com.xxx.xxx [Xlint:invalidAbsoluteTypeName]

最近项目启动遇到一个错误

Caused by: java.lang.IllegalArgumentException: warning no match for this type name: com.xxx.xxx.service [Xlint:invalidAbsoluteTypeName]

原因是切面表达式错误

原始表达式为:

@Around("execution(* com.xxx.xxx.service.*(..))")

修改为

 @Around("execution(* com.xxx.xxx.service..*.*(..))")

不过还有一个诡异的情况令人不解。

就是同样的代码(使用上面的切面表达式),有的同事执行不报错,而有的报错。目前怀疑是IDEA版本问题。

更多内容请参考spring 官方文档

https://docs.spring.io/spring/docs/4.3.15.RELEASE/spring-framework-reference/html/aop.html

该部分内容的简单翻译

常见的切面表达式

1 所有公有方法的执行

execution(public * *(..))

2 所有以set开头的公有方法的执行

execution(* set*(..))

3 AccountService接口下的所有方法的执行

execution(* com.xyz.service.AccountService.*(..))

4 com.xyz.service包下的所有方法的执行

execution(* com.xyz.service.*.*(..))

5 com.xyz.service包及其子包下的所有方法的执行

execution(* com.xyz.service..*.*(..))

6 匹配com.xyz.service包下的所有类的所有方法(不含子包)

within(com.xyz.service.*)

7 com.xyz.service包和子包的所有方法

within(com.xyz.service..*)

8 匹配AccountService的代理类(不支持通配符)

this(com.xyz.service.AccountService)

猜你喜欢

转载自blog.csdn.net/w605283073/article/details/82999927