Using encrypted password with Spring XML Configuration

import org.springframework.jdbc.datasource.DriverManagerDataSource; public class SecureDatabase extends DriverManagerDataSource { @Override public void setPassword(String password) { //The CipherUtils is any class that provides 2-ways cryptography super.setPassword(CipherUtils.decrypt(password)); } } //on the servlet configuration xml when creating the Datasource bean <bean id="dataSource" class="br.com.appus.performance.security.SecureDatasource"> <property name="driverClassName" value="org.mariadb.jdbc.Driver" /> <property name="url" value="jdbc:mysql://127.0.0.1/database" /> <property name="username" value="<username>" /> <property name="password" value="<encrypted_password>" /> </bean>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.