簡體   English   中英

需要更改Context.Xml文件

[英]Need to change the Context.Xml file

我有一個context.xml文件,其中包含一些xml內容。 我需要動態更改bean的值。 我有一個包含bean值的json,我需要使用java在bean屬性中設置該值嗎?

我的context.xml文件

<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>

我需要使用Java動態更改defaultUri的值嗎?

在bean中進行設置后,您始終可以override java中的值。 假設您的defaultUri設置為"https://www.google.com" 然后,使用Java時,您可能會使用諸如setDefaultUri()類的方法,可以在其中使用新值進行設置。
另一個選項是不要在Bean中設置它,而只需在Java中設置它即可。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM