-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@Aspect
does not work in native-image when pointcut expression uses interface
#31739
Comments
@Aspect
does not work in native-image while pointcut expression uses interface
@Aspect
does not work in native-image while pointcut expression uses interface@Aspect
does not work in native-image when pointcut expression uses interface
I imagine you'll need to register runtime hints for See if that line of thinking helps you resolve the issue. If not, please provide a minimal example application that we can run ourselves -- preferably a public Git repository or a ZIP file attached to this issue. |
this is the project: https://github.com/imgoby/spring-cloud-alibaba-graalvm/tree/main/spring-cloud-alibaba-consul-dubbo-provider its dependency is https://github.com/imgoby/spring-cloud-alibaba-graalvm/tree/main/spring-cloud-alibaba-starter-dubbo The relevant class is this:
I'm trying to modify it to an implementation class.So, some codes were changed to : |
Yes, the runtime class maybe ConsulServiceRegistry or EurekaServiceRegistry or NacosServiceRegistry or ZookeeperServiceRegistry.It is defined by user configuration |
I understand a bit now. I may need to make the necessary modifications like this
|
Is that right? |
I don't think Rather, I was saying I think you'll need to register runtime hints for the use of reflection (for evaluating your AspectJ pointcut expression) within a GraalVM native image. |
Potentially related issues: |
Can you provide some sample code? |
Is this OK?But I should write the final implement class in my code. |
Yes, I was suggesting something like that. Though, I don't think you need to register all In any case, can you please confirm that
I don't understand what you mean by that. Can you please expound? |
Previously, it was just an interface called org. springframework. cloud. client. serviceregistry.ServiceRegistry,and there are several implementation classes,such as org.springframework.cloud.consul.serviceregistry.ConsulServiceRegistry.class, Is it written here as follow? |
This is the file I want to modify, even if I use RuntimeHintsRegistry, @before will not be triggered. Is something wrong? |
@ImportRuntimeHints is not working in my project and the issue cannot be resolved. Therefore, I divided the original classes into four. The project is now working normally. |
For example:
org.springframework.cloud.consul.serviceregistry.ServiceRegistry
is an interface.In JVM the code is OK, but it does not work built with native-image (Spring 6.0.11), unless I change it to:
The text was updated successfully, but these errors were encountered: