标签:beans cto web nbsp vat maven row util lists
1、 生成publicKey和password
2、 修改web项目下config文件夹下DruidDataSourceConfigurer文件,
public DruidDataSource dataSource() throws SQLException {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setProxyFilters(Lists.newArrayList(statFilter(),configFilter()));
Properties properties=new Properties();
properties.setProperty("config.decrypt","true");
properties.setProperty("config.decrypt.key",publicKey);
dataSource.setConnectProperties(properties);
return dataSource;
}
@Value("${spring.druid.publicKey}")
private String publicKey;
/**
* 定义空Config类用于加密类的加载
* */
@Bean
public ConfigFilter configFilter(){
ConfigFilter configFilter=new ConfigFilter();
return configFilter;
}
标签:beans cto web nbsp vat maven row util lists
原文地址:https://www.cnblogs.com/niuniu0108/p/13931628.html