java - Trim trailing space in jasypt EncryptablePropertyPlaceholderConfigurer -


we using spring along jasypt encryptablepropertyplaceholderconfigurer read application.properties file.

the problem happen if of properties value contain white-spaces in end, on reading value using @value(${}) tag, trailing space in end creates problems.

now class encryptablepropertyplaceholderconfigurer final can't extended , searched lot figure out if way properties after trimming of white-spaces around string value.

can suggest how handle scenario?

you can create encryptablepropertyplaceholderconfigurer custom stringencryptor passed in constructor. in customstringencryptor.decrypt() trim(). (in case don't know property decrypting)

you can bypass final delegation:

class customstringencryptor implements stringencryptor{   private stringencryptor delegate;    public customstringencryptor(standardpbestringencryptor delegate){     this.delegate = delegate;   }    string decrypt(string encryptedmessage){     string message = this.delegate.decrypt(encryptedmessage);     if(null != message) message = message.trim();     return message;   } } 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -