How do you configure a Spring bean container (or application context) to load a Java property file?
JavaWorld article Smartly Load Your Properties explains how to load p
If you want to reference the object as an instance of java.util.Properties
, you should do the following:
true
classpath:property-file.properties
This allows you to reference the Spring bean properties
as an instance of java.util.Properties
. You can even have it merge together multiple properties files by adding more values to location
. See this description of resource strings for information about what types of values Spring will accept for location. If you are wanting to use ${}
style substitutions in the Spring XML, you can see there are a number of other answers describing how to do that.