I would say you have 2 options
- Load the properties using
<util:properties />
- Use
@PropertySource and the Environment abstraction.
Using <util:properties />
To simply load a properties file you can use the PropertiesFactoryBean or easier the <util:properties /> tag (which uses the PropertiesFactoryBean underneath but is just easier to configure). See here for more information.
Simply add the following to your xml configuration
<util:properties id="transactions" location="classpath:transaction.properties" />
Now you have a Properties bean named transactions which you can inject into your controller after which you can use that to obtain the property you need.
@Autowired
private Properties transactions;
Using @PropertySource and Environment abstraction
Another solution is to add a @Configuration class with a @PropertySource to load the properties. After that you can use the Environment to obtain the properties. See the Environment section in the reference guide for more information.
@Configuration
@PropertySource("classpath:transaction.properties")
public class MyConfiguration {}
In your controller you can use the Environment to obtain the properties.
@Autowired
private Environment env;
Resource Support
Of course the Spring property support is usable with the Resource loading approach of Spring. So file: and http: prefixes work as well, as well as the default loading rules applying to the used ApplicationContext.