我想将xml文件加载到spring bean中作进一步处理。我知道可以加载properties
文件,只需在spring配置文件中定义一个bean属性即可。有没有可能对xml文件做同样的事情?在弹簧中加载xml文件
编辑 例如,我想有一个bean:
public class Bean {
private File file
public void setFile(File file) {
this.file = file
}
//....
}
,并在我的配置文件我想设置这样的:
<bean id="bean" class="blabla.Bean">
<property name="file" value="smth here"/>
</bean>
,然后我想解析使用DOM的xml
可能重复(http://stackoverflow.com/questions/479855/is-there-a-propertyplaceholderconfigurer-like-class-for-use-spring-that-acc) – CoolBeans
另请参阅[PropertyPlaceholderConfigurer从XML文件读取(Apache Commons配置)](http://stackoverflow.com/问题/ 3163838/propertyplaceholderconfigurer-reads-from-xml-file-apache-commons-configuration) – CoolBeans
我不确定我是否理解这个问题 - 你是在谈论属性,或者你想在Spring bean中加载一个XML文件,并且只想在您的配置中定义*哪个*文件? –