I need to load many properties files, which are in the resources folder.
I have a resource called abc_en.properties with the content below:
a = x
b = y
c = z
and I need to use the properties sing java.util.Properties in a Java Method:
java.util.Properties reportProperties = new java.util.Properties();
...
String a = reportProperties.getProperty("a");
How can I do this?
Thanks
You need to define the propertyConfigurer bean in your context file:
EDIT:
In order to use
java.util.Propertiesyou need to define thePropertiesFactoryBeanbean in your context file :Then in your class you need to define a
java.util.Propertiesvarible and load the properties bean into it :There are other ways to load the properties bean into you class, but if you use the
@Autowiredannotation, you need to put the<context:annotation-config />element in you context file.