Java 如何在运行时更改xml中的Springbean属性值?

Java 如何在运行时更改xml中的Springbean属性值?,java,spring,spring-config,Java,Spring,Spring Config,我有一个springconfig.xml文件,用于从my.properties文件获取bean属性值。属性文件值会动态更改。但它不会设置为springbean属性。只有在我重新启动tomcat之后,它才会改变。这是我的xml代码部分 <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location">

我有一个springconfig.xml文件,用于从my.properties文件获取bean属性值。属性文件值会动态更改。但它不会设置为springbean属性。只有在我重新启动tomcat之后,它才会改变。这是我的xml代码部分

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location">
         <value>file:/SATHISH/apache.8.0.24/bin/my.properties</value>
     </property>
    </bean> 

<bean id="jmsEmailTemplateBean" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="authenticationConnectionFactory" />
    <property name="defaultDestination" ref="${queuename}" />
</bean>

文件:/SATHISH/apache.8.0.24/bin/my.properties
如果我将my.properties值更改为“foo”,它将起作用。 我再次在运行时将“foo”改为“boo”,它将不起作用。它不会分配给${queuename}

我在运行时手动更改了我的.properties值。它不会影响springconfig.xml

是否可以在运行时更改xml值?
提前感谢

尝试使用SpringBoot或IntelliJ Idea;)

您需要以编程方式查看文件,以便重新加载更改或使用此bean
org.springframework.context.support.ReloadableResourceBundleMessageSource


重新加载属性文件

只有在重新启动服务器后,属性文件更改才会影响应用程序。如果要更改某些内容,则无需进行任何代码更改,您需要使用属性文件。属性文件用于初始设置。请理解为什么财产档案是。是的,我知道。我使用一些代码在运行时动态更改了这些值。属性文件(my.properties)已更新。但它不会影响springconfig.xml{queuename},也不会影响@Sathish。这就是为什么我告诉你要理解属性文件的概念。如果您正在动态更新值,那么为什么不更新JavaBean本身中的值呢?为什么java到props,然后props到xml,然后xml到java。您可以直接在java中更新该值。再次说明为什么要将其设置为xml。但是,从xml开始,您将用作java对象。所以你可以直接在java对象中设置它。这就是他的问题的答案吗?如果能解决他的问题,请张贴答案。如果你不清楚他们的问题,请在评论部分提问。请发布你认为可以解决他的问题的代码片段。