Java 我们可以读取xml中的.properties文件吗?
我有一个.properties文件,其中包含这些值。我试图将其中一个值设置为xml文件中的字段。 例如,在属性文件中将会话到期时间设置为300秒。 所以我需要在xml文件中设置相同的值Java 我们可以读取xml中的.properties文件吗?,java,xml,jakarta-ee,properties,Java,Xml,Jakarta Ee,Properties,我有一个.properties文件,其中包含这些值。我试图将其中一个值设置为xml文件中的字段。 例如,在属性文件中将会话到期时间设置为300秒。 所以我需要在xml文件中设置相同的值 <max-idle-seconds>300</max-idle-seconds> 300 这300应该从.properties文件中获取。 有人能帮忙吗?是的。在代码下面添加XML <context:property-placeholder location="classpat
<max-idle-seconds>300</max-idle-seconds>
300
这300应该从.properties文件中获取。
有人能帮忙吗?是的。在代码下面添加XML
<context:property-placeholder location="classpath:your_property_filename.properties" ignore-unresolvable="true"/>
或者你可以写:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" lazy-init="false">
<property name="locations">
<list>
<value>classpath:your_property_filename.properties</value>
</list>
</property>
</bean>
classpath:your\u property\u filename.properties
。。。如果我理解正确的话,您只需要以某种方式合并两个xml文件?还有,您打算用什么编程语言来实现这一点呢?一种是xml,另一种是.properties文件。我将在java中添加java标记,它将帮助您获得响应您需要对xml文件进行预处理或后处理。它无法将.properties神奇地插入到xml中。这个标签怎么样?它会加载文件吗?