-
Notifications
You must be signed in to change notification settings - Fork 3.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
Enhance AOT-Support (Issue#3171) #3193
Enhance AOT-Support (Issue#3171) #3193
Conversation
replace registerBeanDefinition callback with a factoryMethod split out a RouterFunctionHolderFactory from the Registrar class and provide its bean in the AutoConfiguration set refresh scope on the RouterFunctionHolder bean only if RefreshScope bean in context and add warning
update outdated comment
add runtimeHintsRegistrar to allow externalized route configuration
now added and imported RuntimeHintsRegistrar to support externalized configs as the one I tested with below (properties-style for readability :-)). The application.properties settings, that run smoothly as native image in my local test setup:
|
@spencergibb May I politely request your review on this? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@ryanjbaxter: Thanks for the reply.
No :-) I authored it myself. But it was in exchange and on request of @spencergibb.
Sorry - I patiently waited for 2 months. I was just worried, it might get lost, though it can add value. |
No I mean the tweet about working for Cockroach was not from Spencer, he just retweeted it. I promise we will get to it eventually, we appreciate the PR! |
Not going anywhere |
I'm waiting for this PR getting release |
@maradanasai Please watch https://github.com/spring-cloud/spring-cloud-release/milestones this will be part of 2023.0.1 in mid march |
...ngframework/cloud/gateway/server/mvc/config/GatewayMvcPropertiesBeanDefinitionRegistrar.java
Outdated
Show resolved
Hide resolved
revert accidental reordering of imports
I want @OlgaMaciaszek to look, and she will be back next week. The release has been rescheduled for later this month, 2024-03-26. |
# Conflicts: # spring-cloud-gateway-server-mvc/src/main/java/org/springframework/cloud/gateway/server/mvc/config/GatewayMvcPropertiesBeanDefinitionRegistrar.java
resolve merge conflicts
@spencergibb @OlgaMaciaszek maven verify passes fine. |
Re-running build. Still want @OlgaMaciaszek to look |
Yes, sure! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @wisskirchenj, the hints implementation looks good, but have added some minor comments. Please address.
.../org/springframework/cloud/gateway/server/mvc/config/GatewayMvcAotRuntimeHintsRegistrar.java
Show resolved
Hide resolved
.../org/springframework/cloud/gateway/server/mvc/config/GatewayMvcAotRuntimeHintsRegistrar.java
Outdated
Show resolved
Hide resolved
.../org/springframework/cloud/gateway/server/mvc/config/GatewayMvcAotRuntimeHintsRegistrar.java
Outdated
Show resolved
Hide resolved
.../org/springframework/cloud/gateway/server/mvc/config/GatewayMvcAotRuntimeHintsRegistrar.java
Outdated
Show resolved
Hide resolved
.../org/springframework/cloud/gateway/server/mvc/config/GatewayMvcAotRuntimeHintsRegistrar.java
Outdated
Show resolved
Hide resolved
.../org/springframework/cloud/gateway/server/mvc/config/GatewayMvcAotRuntimeHintsRegistrar.java
Show resolved
Hide resolved
@OlgaMaciaszek Thank you for your review. I have incorporated all your comments - except the one with the package modifier on Registrar class, as with the present locations of Registrar and AutoConfiguration classes |
Changes:
Remarks:
fixes #3171
RouterFunctionHolderFactory
class from the Registrar (similar to what Josh did in his hacking session on UTube recently) in order to make this a bean and thus accessible for factory methods. My first solution was to just create the wholeGatewayMvcPropertiesBeanDefinitionRegistrar
class as bean in addition to its@Import
-role asImportBeanDefinitionRegistrar
. But I did not like this too much, as it puts "too much hats" on this class.However, if the amount of code changes scares you off now, this partial solution (not including the Runtime Hints) with just like 6 LOC changes is still available as branch wisskirchenj@a718c27
spring.cloud.refresh.enabled
is not explicitly set to false. So in order to not crash in AOT, the user has to explicitly set this - but it seems to be in accordance with Spring Cloud Config, where there even is an explicit warning in the docs to do that for AOT (might be useful to add in gateway mvc docs too..). Still I think, the newbie to gateway-mvc will likely not set / know that.That is why I gave an instructive warning in the Registrar class.