It is useful to have different property sets for different users.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:property-placeholder
location="classpath:/path/to/package/default.properties,
classpath:/path/to/package/#{ systemProperties['user.name'] }.properties"/>
</beans>
When executing the application, spring does not recognize the expression. The context does not start and spring says: class path resource [path/to/package/#{ systemProperties['user.name'] }.properties] cannot be opened
When I replace the expression manually with a string resulting in a valid resource then the behaviour is as expected. The manual states it should work.
The spring-context and spring-core (3.1.2-RELEASE) are in classpath.
SpEL expressions are not allowed there; you can do what you want indirectly, though...
<context:property-placeholder properties-ref="props"/>
<util:properties id="props" location="classpath:#{systemProperties['foo']}"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With