0

I have an XML-Based configuration just like this in Spring :

<bean id="bean101" class="org.springframework.ws.client.core.WebServiceTemplate" scope="singleton">
    <property name="marshaller" ref="xmlBeansMarshaller" />
    <property name="unmarshaller" ref="xmlBeansMarshaller" />
    <property name="defaultUri" value="http://127.0.0.1/services/WebServices/xyz.asmx?wsdl" />
</bean>
<bean id="bean102" class="org.springframework.ws.client.core.WebServiceTemplate" scope="singleton">
    <property name="marshaller" ref="xmlBeansMarshaller"/>
    <property name="unmarshaller" ref="xmlBeansMarshaller"/>
    <property name="defaultUri" value="http://127.0.0.1/XYZService/MyService/MyService.svc?wsdl"/>
</bean>

I would like to ask/verify if I can dynamically insert a new Bean element, for instance "Bean103" upon runtime? If yes, is it possible that the changes from this XML-based configuration would take effect without restarting the server? Thanks a lot!

  • You could change your XML file before creating ApplicationContext from that file. You could also programmatically add/modify bean definitions which were loaded from XML file. Check answers to these questions: https://stackoverflow.com/questions/4540713/add-bean-programmatically-to-spring-web-app-context and https://stackoverflow.com/questions/11606504/registering-beansprototype-at-runtime-in-spring – Ivan Jan 02 '18 at 18:59
  • Thank you, I'll let you know the result of this. :) – Maricor Palangao Jan 09 '18 at 04:59

0 Answers0