Skip to content

Instantly share code, notes, and snippets.

@javaduke
Created June 9, 2011 12:54
Show Gist options
  • Save javaduke/1016673 to your computer and use it in GitHub Desktop.
Save javaduke/1016673 to your computer and use it in GitHub Desktop.
Jasypt configuration
<!-- -->
<!-- Configuration for encryptor, based on environment variables. -->
<!-- -->
<!-- In this example, the encryption password will be read from an -->
<!-- environment variable called "MULE_ENCRYPTION_PASSWORD" which, once -->
<!-- the application has been started, could be safely unset. -->
<!-- -->
<spring:bean id="environmentVariablesConfiguration"
class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
<spring:property name="algorithm" value="PBEWithMD5AndDES" />
<spring:property name="passwordEnvName" value="MULE_ENCRYPTION_PASSWORD" />
</spring:bean>
<!-- -->
<!-- The will be the encryptor used for decrypting configuration values. -->
<!-- -->
<spring:bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
<spring:property name="config" ref="environmentVariablesConfiguration" />
</spring:bean>
<!-- -->
<!-- The EncryptablePropertyPlaceholderConfigurer will read the -->
<!-- .properties files and make their values accessible as ${var} -->
<!-- -->
<!-- Our "configurationEncryptor" bean (which implements -->
<!-- org.jasypt.encryption.StringEncryptor) is set as a constructor arg. -->
<!-- -->
<spring:bean id="propertyConfigurer"
class="org.jasypt.spring.properties.EncryptablePropertyPlaceholderConfigurer">
<spring:constructor-arg ref="configurationEncryptor" />
<spring:property name="locations">
<spring:list>
<spring:value>credentials.properties</spring:value>
</spring:list>
</spring:property>
</spring:bean>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment