旧项目配置的jdbc.password不知道在哪里解密的,将密文删掉一个字母,让它报出错误栈,如图:
很明显spring的源码类PropertyResourceConfigurer.java调用了项目中的继承类MPropertyPlaceholderConfigurer.java
public class MPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {
protected static final String JEDIS_PASSWORD = "redis.password";
protected static final String JDBC_PASSWORD = "jdbc.password";
protected static final String SECRET_KEY_DEFAULT = "12345688";
public MPropertyPlaceholderConfigurer() {
}
protected String convertProperty(String propertyName, String propertyValue) {
return !"jdbc.password".equals(propertyName) && !"redis.password".equals(propertyName) ? this.convertPropertyValue(propertyValue) : Cryption.decryption(propertyValue, "12345688");
}
}
查看代码,果然继承了类PropertyResourceConfigurer,并重写convertProperty方法,在此处解密操作。