-
Notifications
You must be signed in to change notification settings - Fork 789
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
AOT/native compilation not working with FeignClient and AOP #860
Comments
This issue started occurring after upgrading to Spring Boot 3.0.6 from 3.0.5 so it seems to be some regression bug. Unfortunately I have not been able to track down what causes it. |
I was able to get somewhat further when manually adding the aot hint for a proxy for the client interface. It now allows the application to start, albeit slowly, due to a missing resource (not at my pc atm. I'll post the specific logs later), but it can't find the HttpMessageConverter when trying to use the client. I'll see if I can make a public git repo available demonstrating the issues, when I have time. |
@Rocker93 I am actually using 3.0.5 |
@OlgaMaciaszek |
Thanks a lot, @CC007. Should be able to get to it around 8th of May. |
No problem. If you have any questions, feel free to reply here or message me on Discord: cc007#2753 |
Also, one thing I noticed is that when
This leads to a significant startup delay, because I'm using a vEthernet (External switch) adapter from hyper-v to route my internet (this was needed to get LAN IP addresses for my hyper-v VMs). spring:
cloud:
inetutils:
preferred-networks:
- 192.168 ...should have fixed this, but due to the config not getting picked up in the post processor, the startup delay is not prevented. This happened even without native compilation. |
I think the issue in my previous comment is out of scope, so I created an issue in the appropriate issue tracker: spring-cloud/spring-cloud-commons#1233 |
FYI: I manually added https://github.com/CodeQualIT/CQITFunctions/blob/master/pocs/boxedhello-project/boxedhello-generated/boxedhello-clients/boxedhello-helloworld-client/src/main/java/nl/cqit/function/poc/java/boxedhello/services/helloworld/HelloWorldServiceRuntimeHints.java as a partial workaround. This makes it so that the application starts, but it still causes issues when calling the client. Also, I'd expect these runtime hints for feign clients to be automatically added by openfeign, without user intervention. |
Hello @CC007 , I've tried running the project, but the |
Probably caused by Spring Boot issue: spring-projects/spring-boot#35397. |
There are 2 projects in the poc folder: helloworld and boxedhello. Boxedhello uses the interface of helloworld to create a feign client. I now created a 3rd project in the poc folder with the amount of modules reduced and with the helloworld interface added as submodule, so that it can be built independently. |
Thanks, @CC007. It seems 2 different issues have been discussed here. @Rocker93 if you have a project not working with Boot The second issue is the one present in the project @CC007 has linked. This issue seems specifically linked to the use of AOP alongside OpenFeign. I was able to reproduce it. Looks like a bug. |
The question is: is this one bug or 2 bugs? The fact that I manually have to add the runtime hint is one bug, but I don't know if the errors I get related to Is that one also caused by a missing runtime hints? |
Any progress regarding this issue? |
@CC007 I will work on it this week or at the beginning of the next week. |
Thanks @dpozinen, as requested above, please provide a minimal, complete, verifiable example that reproduces the issue. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
I found the problem. It's happen when I use @Cacheable inside FeignClient interface. I removed and resolve the problem. Thanks. |
I will also check to see if it resolved the issue on my side. I'll keep you posted. |
It seems to work on the minimal-upgraded-sample branch, but on the master branch I do get an exception when I try to call the endpoint:
Using the master branch of boxedhello-minimal-app (while helloworld-app is also running of course) I might be missing something small and stupid, but I don't see the reason for this error. |
@CC007 I have requested the minimal sample, because the |
@til-avalaszek |
Hmm... I created a new branch named minimal-with-openapi, but that one seems to also work fine, even though it's not that different from the master branch. I'll research a little bit more why there's a difference. |
ok, @CC007, please get back to us once you've got more details or a minimal reproducer. |
I narrowed it down to whether the helloworld and boxedhello controller are in the same application or separate applications. See minimal-with-openapi vs minimal-separate-apps, where minimal-with-openapi does work and minimal-separate-apps gives the exception when natively compiled. Simply moving over the |
Thanks, @CC007 - will take a look. |
Ah, from what I gather from the commit, the issue was that the abstract methods were defined on (one of) the super interface(s). I'll take a look to see if this fixes my issue (and might even remove the need for the type hint that I already added). |
Woo! HTTP/1.1 200
Content-Type: application/json
Content-Length: 77
Date: Mon, 13 May 2024 21:16:14 GMT
+-----------------------+
| Hello, Separate Apps! |
+-----------------------+ Thank you very much for your help, @OlgaMaciaszek ! There was a lot of effort on your part to get it working. It does still rely on
For now that's fine though, unless you feel like you want to fix that too. |
Thanks @CC007, will take a look at it today. |
@CC007 This seems to be related to having both the OF proxy and advised proxies used together. This is a specific scenario that has not been reported by others, so I'd say you should just use the hints registrar. |
I have verified it works for me as well with the hints. Thank you for your efforts |
Describe the bug
I read that starting spring-cloud 2022.0.0, you can use native compilation. I'm using 2022.0.2 (spring-cloud-starter-openfeign:4.0.2), but when I use an OpenFeign client with native compilation, I get the following error:
Sample
Here is my API:
And here is my Feign client:
I'm using it like this:
With this as my Main class:
Using this profile for native compilation in my pom.xml:
Is this a bug or am I missing something?
The text was updated successfully, but these errors were encountered: