简体   繁体   中英

Need to change the Context.Xml file

I have a context.xml file that contains some xml content. I need to change the value of bean dynamically. I have a json that contain the value of the bean, I need to set that value in that bean property using java?

my context.xml file

<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
        <constructor-arg ref="messageFactory" />
        <property name="marshaller" ref="xmlbeansMarshaller" />
        <property name="unmarshaller" ref="xmlbeansMarshaller" />
        <property name="defaultUri"
            value="https://www.google.com" />
    </bean>

I need to change the value of defaultUri dynamically using java?

you can always override the value in java after setting in bean. Lets say your defaultUri is set to "https://www.google.com" . Then using java you might some method like setDefaultUri() where you can set it with a new value.
Other option is donot set it in the bean, just do it in java.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM