This isn't working:
<?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:encryption="http://www.jasypt.org/schema/encryption"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.jasypt.org/schema/encryption
http://www.jasypt.org/schema/encryption/jasypt-spring31-encryption-1.xsd">
<import resource="properties/secure/jasypt-context.xml" />
<bean name="propEnvironment" class="java.lang.String">
<constructor-arg value="#{ systemProperties['property.environment'] ?: systemProperties['cfg.environment'] }" />
</bean>
<encryption:encryptable-property-placeholder
encryptor="configurationEncryptor"
location="classpath:properties/#{propEnvironment}/*.properties,classpath:properties/common.properties" />
</beans>
Only common.properties gets configured by the encryptable property placeholder. It's like the other entry just disappears (no error is thrown or anything, it just doesn't load anything else). I want to stand up an instance with the production config files, but I want to use my dev properties. The spel expression is evaluating properly if I print that out. Is this possible?
When I try this,
<bean name="propEnvironment" class="java.lang.String" id="testing">
<constructor-arg value="#{ systemProperties['property.environment'] ?: systemProperties['cfg.environment'] }" />
</bean>
<bean name="fullString" class="java.lang.String">
<constructor-arg value="classpath:properties/#{ systemProperties['property.environment'] ?: systemProperties['cfg.environment'] }/*.properties" />
</bean>
<bean class="EchoBean" lazy-init="false">
<constructor-arg ref="propEnvironment" />
</bean>
<bean class="EchoBean" lazy-init="false">
<constructor-arg ref="fullString" />
</bean>
<bean class="EchoBean" lazy-init="false">
<constructor-arg value="#{@testing.toString()}" />
</bean>
<bean class="EchoBean" lazy-init="false">
<constructor-arg value="blah" />
</bean>
The third echo using the @ syntax does not produce any output.
2014-02-14 10:03:41,998 [main] INFO EchoBean - local
2014-02-14 10:03:42,000 [main] INFO EchoBean - classpath:properties/local/*.properties
2014-02-14 10:03:42,000 [main] INFO EchoBean - blah