I have an xml file that contains values that define a java object, the values are processed via a java method to handle some specific tasks, the xml file has the below architecture :
<javaObject>
<attr1>value1</attr1>
<attr2>${property.name}</attr2>
<attr3>value3</attr3>
</javaObject>
My goal is to get the attr2 from the property file, I've tried ${property.name} but it's not working, I've also tried <property name="property.name" value="${property.name} />
At runtime, I get a NULL when I call the value of attr2
What is the best way to implement that ?
If I understand your question correctly, you unmarshal the object and want to work with the value of proeprty.name? You can inject the value of property.name in your class via
@Value("${property.name}")
String propertyName
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.