Closed wangliang181230 closed 1 year ago
I think this should have been fixed by https://github.com/spring-projects/spring-framework/issues/29519. Please test with the latest version of Spring Boot. If the problem still occurs, please open a Spring Framework issue.
Fixed, Thanks.
This exception only throw in the
native-image
. When runningspring-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: https://github.com/oracle/graal/issues/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