Details
-
Feature Request
-
Resolution: Obsolete
-
Major
-
None
-
None
-
None
Description
The use case here is that a framework has provided the application developer with some bean, X. While the framework can provide internal post construction support for this bean, the application developer has some need to set additional attributes on the bean prior to the bean being injected into its final target.
The application developer currently has no way to do this. To accomplish this feat, the framework developer must put the burden on the application developer to do both configuration and bootstrapping of this bean. This is a bit of a pain point to be honest.
One idea I had was to introduce a @Configures annotation that could be used, similar to observers. These methods (plural) could be called (based on priority) during the post construct phase and may exist in any managed bean.
@Configures
public void setupWebServer(WebServer webserver, Configuration configuration) {
webserver.setPort(configuration.getWebServerPort());
}
In this case, webserver is the bean being configured, configuration is some other bean that retains the configuration data. This should support normal qualifiers, and perhaps provide an injection point for the underlying InjectionTarget