In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the Springboot2 integrated druid encryption database password configuration related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this Springboot2 integrated druid encryption database password configuration article will have a harvest, let's take a look.
One: environment
Springboot 2.x
Druid 1.1.21
Two: druid encrypts the database password
Download the druid-1.1.21.jar package locally, run cmd, and enter the command
Java-cp jar package path com.alibaba.druid.filter.config.ConfigTools database password java-cp druid-1.1.21.jar com.alibaba.druid.filter.config.ConfigTools database password
Run successfully output
PrivateKey:MIIBVAIBAD...
PublicKey:MFwwDQYJKo...
Password:PNd/zcG+JEn...
Fill the resulting publicKey and password into the yml configuration file respectively.
Three: single data source
Add dependency
Com.alibaba druid-spring-boot-starter 1.1.21
Yml configuration
Spring: datasource: name: name url: address username: user name password: encrypted password driver-class-name: com.mysql.cj.jdbc.Driver # druid type: com.alibaba.druid.pool.DruidDataSource druid: # Special Tip: configure database encryption config this can not forget filters: stat,wall Config use-global-data-source-stat: true # enable decryption config.decrypt=true Public key: config.decrypt.key connect-properties: druid.stat.mergeSql: true druid.stat.slowSqlMillis: 5000 druid.stat.logSlowSql: true config.decrypt: true config.decrypt.key: public key # configuration information of connection pool # initialization size, minimum number of idle connections Maximum number of active initial-size: 5 min-idle: 5 maxActive: 20 # configure the time to get connection wait timeout maxWait: 60000 # configure how often to detect idle connections that need to be closed, in milliseconds timeBetweenEvictionRunsMillis: 60000 # configure the minimum survival time of a connection in the pool Unit: millisecond minEvictableIdleTimeMillis: 300000 validationQuery: SELECT 1 FROM DUAL testWhileIdle: true testOnBorrow: false testOnReturn: false # Open PSCache and specify the size of the PSCache on each connection poolPreparedStatements: true maxPoolPreparedStatementPerConnectionSize: 20 IV: multiple data sources
Add dependency
Com.alibaba druid-spring-boot-starter 1.1.21 com.baomidou dynamic-datasource-spring-boot-starter 2.5.3
Startup class configuration
@ SpringBootApplication (exclude = DruidDataSourceAutoConfigure.class)
Eg:
Yml configuration
Spring: datasource: dynamic: # default data source primary: CLOUD datasource: CLOUD: url: database address username: user name password: encrypted password driver-class-name: com.mysql.cj.jdbc.Driver druid: public-key: encrypted public key WAREHOUSE: driver-class-name: com.mysql.cj.jdbc.Driver url: database address username: user name password: encrypted password druid: public-key: encrypted public key on "how to configure Springboot2 integrated druid encrypted database password" this article ends here Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "Springboot2 integrated druid encryption database password configuration". If you want to learn more knowledge, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.