-
Notifications
You must be signed in to change notification settings - Fork 9
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
fix(spring): allow bean injection by constructor #126
base: master
Are you sure you want to change the base?
fix(spring): allow bean injection by constructor #126
Conversation
I have test it against:
|
} else { | ||
logger.debug("Instances for type {} already loaded. Skipping...", getObjectType().getName()); | ||
} | ||
|
||
return factories; | ||
} | ||
|
||
private Collection<? extends T> getSpringFactoriesInstances(Class<T> type, Class<?>[] parameterTypes, Object... args) { | ||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); |
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.
There is a specific mechanism for loading classes and beans for plugins. By removing this part you may break the plugin spring beans loading, inheritance, and separations. Are you able to confirm/infirm this in some way ?
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.
This is why I try multiples deployments. I haven't a global view on how it's used in gravitee. I don't know make more tests.
I make this part only to cleanup the file (don't use deprecated method), but I can reduce the changeset to the minimum to be more confident
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.
I have splited in 2 commits one with minimal fix and another with improvments
Allow to instanciate this type of bean https://github.com/gravitee-io/gravitee-federation-agent/blob/2.7.1/gravitee-federation-agent-standalone/gravitee-federation-agent-standalone-container/src/main/java/com/graviteesource/integration/agent/standalone/probes/StatusProbe.java - fully rely on Spring to instanciate beans (by constructors, fields or any else) - spring already inject ApplicationContext if need - should allow usage of @PostConstruct - use more simple function to get all beans for a type APIM-7022
a7ac22b
to
0516a07
Compare
I will make more integration tests on each implementations of I put the PR in draft until I will make it |
Issue
https://gravitee.atlassian.net/browse/APIM-7022
Description
Allow to instanciate this type of bean StatusProbe
Gravitee.io Automatic Deployment
🚀 A prerelease version of this package has been published on Gravitee's private artifactory, you can:
4.6.0-apim-7022-SpringFactories-instanciates-beans-SNAPSHOT