We have an application with a white designation (one application that supports corporate experience for several customers). We would like to be able to download a joint version of the component to support custom components for each client. For example, something like:
<bean id="service" class="com.blah.myService" primary="true"> <property name="myBean" ref="bean" /> </bean> <bean id="service_123" class="com.blah.myService"> <property name="myBean" ref="bean" /> </bean> <bean id="bean" class="com.blah.Bean" primary="true"/> <bean id="bean_123" class="com.blah.Bean" />
We tried to subclass ApplicationContext, and this works for the top-level bean, but auto-negotiated collaborators connect and cache during spring boot.
As an example, if I call getBean ("service"), I can intercept the call in my custom ApplicationContext and return service_123, but the "bean" property uses the cached version and does not call the getBean method again, so I cannot connect to the user version.
Is there an easy way to achieve this type of custom runtime injection?
source share