This is my config where i have defined my properties file ie dev.properties which has some encrypted values. I have defined my secure property placeholder but its not working
<global-property doc:name="Global Property" doc:id="7080a89f-d39c-485d-99c4-b35337ab62c4" name="env" value="dev" />
<global-property doc:name="Global Property" doc:id="5d1fb026-a34f-490f-9b50-7a9bcb5cdf83" name="enc.key" value="password" />
<configuration-properties doc:name="Configuration properties"
doc:id="7448fcf9-e3ef-41b4-879e-9551ab99aa29" file="properties/${env}.properties" />
<secure-properties:config name="Secure_Properties_Config" doc:name="Secure Properties Config" doc:id="0bbad3ed-42bb-4e13-bc88-e9c1fc6d21f4" file="properties/${env}.properties" key="${enc.key}" >
</secure-properties:config>
I have encrypted using the value password with AES algorithm. However its not able to decrypt those values with the config provided.
First you are loading the same properties file using configuration-properties
and then again using secure-properties
. Only load the file once using secure-properties
if it contains secure-properties
.
Second, you need to use ${secure:myProp.someProp}
syntax to read secure properties, rather than just ${myProp.someProp}
If you are using the same file for secure and non-secure properties, you still have to use ${secure:myProp.someProp}
for the non-secure properties.
Therefore it is best practice to split your property files into ${env}.properties
for non-secure and ${env}-secure.properties
for secure properties. Then you can use configuration-properties ${env}.properties and secure-properties for ${env}-secure.properties
.
If you are getting a specific error, please update the question with details.