-
Notifications
You must be signed in to change notification settings - Fork 216
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
Spring beans are not loaded in managed dependent resource #2166
Comments
Hi @rameshmalla , (Also calling an external service during desired is probably not a good idea, this might slow down the reconciliation even if nothing changed) |
Note that this work in Quarkus extension, if you want to give that a try. |
This is a valid use-case IMO. It is very common to receive configuration properties via Spring DI, for example. The only way I found to work around this limitation was to create a custom The last time I checked, this was not possible when using |
I mean in general it is a valid use cases to have these beans injected, and have some config params in their. Was referring to this part: calling an external service while computing a desired. At least would cache the result (with some timeout) for some time on client side so it is not called every time desired is computed (what can be very frequent in some cases ). |
Only problem is that we don't have the bandwidth for such improvements, if anybody would volunteer to implement it in the SB starter, would be a big help. |
Thanks, @csviri and @kosmoz for your inputs and suggestions, Indeed quarkus looks like a promising option I will explore the possibilities of migrating from spring-boot to quarkus. Meanwhile I will try to replicate @kosmoz suggestion on having a custom |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
Bug Report
What did you do?
I'm using
josdk-spring-boot-starter
to build an operator with a managed dependent resource, something similar to this example. When I inject a spring bean inside the dependent resource, on application startup I noticed that the spring beans were not instantiated and were alwaysnull
. For example, in this demo application the operator fails due to NPE hereIn a nutshell, the whole spring proxied dependent resource was ignored by the operator framework and instead created another instance of the dependent resource.
What did you expect to see?
The expectation from the framework is not to ignore spring proxied beans.
What did you see instead? Under which circumstances?
Spring beans are not instantiated.
Environment
Kubernetes cluster type: vanilla
$ Mention java-operator-sdk version from pom.xml file
Build file is here
$ java -version
17$ kubectl version
Possible Solution
Additional context
I have a demo application with the similar setup. The tests were failing because of the above mentioned issue.
The text was updated successfully, but these errors were encountered: