When @Aspect
and @FeignClient
are used simultaneously in one application, an exception will be thrown in native-image
#34388
Labels
for: external-project
For an external project and not something we can fix
This exception only throw in the
native-image
.When running
spring-aot-mode
withoutnative-image
, this exception will not be thrown.Through adding logs and debugging, found that the root cause is that the JDK proxy object cannot perform the 'getMethod' operation in the
native-image
, it will threw theNoSuchMethodException
, resulting in themethod
obtained by the 'ClassUtils. getMostSpecificMethod (...)' method is not as expected.For example:
jdkProxy.getClass().getMethod(methodName);
will throwNoSuchMethodException
innative-image
, even if the method exists in the proxied interface.I also report another issue: oracle/graal#6079
The simplest example:
https://github.com/wangliang181230/example__spring-projects_spring-boot_issue-34388
Classes:
My FeignClient
My Aspect
Modified
AspectJExpressionPointcut
and print error log:I modified the
AspectJExpressionPointcut
to catch the exception and print exception log.Otherwise, the application will not start.
The modified
AspectJExpressionPointcut
:The error log in
native-image
:Other DEBUG information
Recurrence steps:
git clone https://github.com/wangliang181230/spring-projects_spring-boot_issue-34388.git
mvn clean native:compile -Pnative
start ./target/spring-projects_spring-boot_issue-34388.exe
, it will print the error log 3 times.http://localhost:8080/confirm-bug
to confirm the BUG.Environment and versions:
OS:
Windows 10
JDK:
graalvm-ce-java17-22.3.1
Spring Boot:
3.0.0
Native maven plugin:
0.9.20
The text was updated successfully, but these errors were encountered: