I have a datasource in tomcat which has password that is encrypted using some algorithm and I want to decrypt the same when i establish connection with DB.
Following is my spring config code
The above bean is a custom one that extends the JndiObjectFactoryBean
public class EncryptedDataSource extends JndiObjectFactoryBean{ ... }
What should I do here to get the encryted password and set it back.
I have my decrytion algorithm with me but I am not sure which super class method will fetch me the password that i can set back again.
Please suggest, i have search and tried a lot.
解决方案
I figured it out, Instead of overriding the JndiBeanFacotry, I used the tomcat data source "factory" property, it allows you to have a custom resource factory class that gets called every time data source lookup is instantiated.
Below link specifies step by step configuration,
"Adding Custom Resource Factories" section emphasises how to write a simple custom resource factory.
Thanks.