Commit b3785a14 by 张富康

chore(config): 更新数据库连接配置为正式环境

- 激活appletBusinessAnalysis中的正式数据库连接配置
- 注释掉开发测试环境的数据库配置
- 注释掉测试环境的相关数据库配置
- 启用生产环境my.properties中的正式数据库连接配置
- 恢复生产环境binlog相关配置及路径信息
1 parent 0af4f5dd
...@@ -4,10 +4,10 @@ server.port=8091 ...@@ -4,10 +4,10 @@ server.port=8091
#广联正式 #广联正式
#spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
#spring.datasource.url=jdbc:mysql://192.168.5.24:3306/dj_operationreport?rewriteBatchedStatements=true&allowMultiQueries=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=30000&socketTimeout=60000 spring.datasource.url=jdbc:mysql://192.168.5.24:3306/dj_operationreport?rewriteBatchedStatements=true&allowMultiQueries=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=30000&socketTimeout=60000
#spring.datasource.username=user_jinglf spring.datasource.username=user_jinglf
#spring.datasource.password=jr2vL8Tx spring.datasource.password=jr2vL8Tx
## ##
...@@ -16,11 +16,11 @@ server.port=8091 ...@@ -16,11 +16,11 @@ server.port=8091
#开发测试 #开发测试
spring.datasource.driverClassName=com.mysql.jdbc.Driver #spring.datasource.driverClassName=com.mysql.jdbc.Driver
#spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver #spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://192.168.3.227:3306/dj_smartcarlife?rewriteBatchedStatements=true&allowMultiQueries=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=30000&socketTimeout=60000 #spring.datasource.url=jdbc:mysql://192.168.3.227:3306/dj_smartcarlife?rewriteBatchedStatements=true&allowMultiQueries=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=30000&socketTimeout=60000
spring.datasource.username=dev_admin #spring.datasource.username=dev_admin
spring.datasource.password=1f7e1ed2 #spring.datasource.password=1f7e1ed2
......
...@@ -20,45 +20,45 @@ spring.datasource.dj_smartcarlife1.password=jr2vL8Tx ...@@ -20,45 +20,45 @@ spring.datasource.dj_smartcarlife1.password=jr2vL8Tx
#测试环境 application.properties #测试环境 application.properties
spring.datasource.dj_business_school.jdbc-url=jdbc:mysql://192.168.1.39:3306/dj_business_school?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8 #spring.datasource.dj_business_school.jdbc-url=jdbc:mysql://192.168.1.39:3306/dj_business_school?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8
spring.datasource.dj_business_school.driver-class-name=com.mysql.jdbc.Driver #spring.datasource.dj_business_school.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.dj_business_school.username=insurance_user #spring.datasource.dj_business_school.username=insurance_user
spring.datasource.dj_business_school.password=123456 #spring.datasource.dj_business_school.password=123456
#
spring.datasource.dj_smartcarlife.jdbc-url=jdbc:mysql://192.168.3.93:3307/dj_smartcarlife?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8 #spring.datasource.dj_smartcarlife.jdbc-url=jdbc:mysql://192.168.3.93:3307/dj_smartcarlife?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8
spring.datasource.dj_smartcarlife.driver-class-name=com.mysql.jdbc.Driver #spring.datasource.dj_smartcarlife.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.dj_smartcarlife.username=user_jinglf #spring.datasource.dj_smartcarlife.username=user_jinglf
spring.datasource.dj_smartcarlife.password=jr2vL8Tx #spring.datasource.dj_smartcarlife.password=jr2vL8Tx
#
spring.datasource.scrm_account.jdbc-url=jdbc:mysql://192.168.3.222:3308/scrm_account?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8 #spring.datasource.scrm_account.jdbc-url=jdbc:mysql://192.168.3.222:3308/scrm_account?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8
spring.datasource.scrm_account.driver-class-name=com.mysql.jdbc.Driver #spring.datasource.scrm_account.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.scrm_account.username=user_jinglf #spring.datasource.scrm_account.username=user_jinglf
spring.datasource.scrm_account.password=jr2vL8Tx #spring.datasource.scrm_account.password=jr2vL8Tx
#
spring.datasource.insert.jdbc-url=jdbc:mysql://192.168.3.227:3306/dj_smartcarlife?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8 #spring.datasource.insert.jdbc-url=jdbc:mysql://192.168.3.227:3306/dj_smartcarlife?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8
spring.datasource.insert.driver-class-name=com.mysql.jdbc.Driver #spring.datasource.insert.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.insert.username=dev_admin #spring.datasource.insert.username=dev_admin
spring.datasource.insert.password=1f7e1ed2 #spring.datasource.insert.password=1f7e1ed2
#
spring.datasource.query.jdbc-url=jdbc:mysql://192.168.3.227:3306/dj_smartcarlife?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8 #spring.datasource.query.jdbc-url=jdbc:mysql://192.168.3.227:3306/dj_smartcarlife?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8
spring.datasource.query.driver-class-name=com.mysql.jdbc.Driver #spring.datasource.query.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.query.username=dev_admin #spring.datasource.query.username=dev_admin
spring.datasource.query.password=1f7e1ed2 #spring.datasource.query.password=1f7e1ed2
#
binlogip=192.168.1.39 #binlogip=192.168.1.39
binlogport=3306 #binlogport=3306
binlogdb=dj_smartcarlife #binlogdb=dj_smartcarlife
binlogusername=insurance_user #binlogusername=insurance_user
binlogpassword=123456 #binlogpassword=123456
binlogip2=192.168.1.39 #binlogip2=192.168.1.39
binlogport2=3306 #binlogport2=3306
binlogdb2=scrm_account #binlogdb2=scrm_account
binlogusername2=insurance_user #binlogusername2=insurance_user
binlogpassword2=123456 #binlogpassword2=123456
#测试 ##测试
absolutePath =/app/soft/java_project/appletBusinessAnalysis/品牌.json #absolutePath =/app/soft/java_project/appletBusinessAnalysis/品牌.json
apiUrlName=测试 #apiUrlName=测试
whereupgradegoodstypesuppliercode=upgradegoodstypesuppliercode_test #whereupgradegoodstypesuppliercode=upgradegoodstypesuppliercode_test
...@@ -142,49 +142,49 @@ whereupgradegoodstypesuppliercode=upgradegoodstypesuppliercode_test ...@@ -142,49 +142,49 @@ whereupgradegoodstypesuppliercode=upgradegoodstypesuppliercode_test
#生产环境 application.properties #生产环境 application.properties
#spring.datasource.dj_business_school.jdbc-url=jdbc:mysql://192.168.5.23:3306/dj_business_school?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8 spring.datasource.dj_business_school.jdbc-url=jdbc:mysql://192.168.5.23:3306/dj_business_school?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8
#spring.datasource.dj_business_school.driver-class-name=com.mysql.jdbc.Driver spring.datasource.dj_business_school.driver-class-name=com.mysql.jdbc.Driver
#spring.datasource.dj_business_school.username=user_jinglf spring.datasource.dj_business_school.username=user_jinglf
#spring.datasource.dj_business_school.password=jr2vL8Tx spring.datasource.dj_business_school.password=jr2vL8Tx
#
#spring.datasource.dj_smartcarlife.jdbc-url=jdbc:mysql://192.168.5.23:3306/dj_smartcarlife?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8 spring.datasource.dj_smartcarlife.jdbc-url=jdbc:mysql://192.168.5.23:3306/dj_smartcarlife?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8
#spring.datasource.dj_smartcarlife.driver-class-name=com.mysql.jdbc.Driver spring.datasource.dj_smartcarlife.driver-class-name=com.mysql.jdbc.Driver
#spring.datasource.dj_smartcarlife.username=user_jinglf spring.datasource.dj_smartcarlife.username=user_jinglf
#spring.datasource.dj_smartcarlife.password=jr2vL8Tx spring.datasource.dj_smartcarlife.password=jr2vL8Tx
#
#spring.datasource.scrm_account.jdbc-url=jdbc:mysql://192.168.5.1:3310/scrm_account?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8 spring.datasource.scrm_account.jdbc-url=jdbc:mysql://192.168.5.1:3310/scrm_account?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8
#spring.datasource.scrm_account.driver-class-name=com.mysql.jdbc.Driver spring.datasource.scrm_account.driver-class-name=com.mysql.jdbc.Driver
#spring.datasource.scrm_account.username=user_jinglf spring.datasource.scrm_account.username=user_jinglf
#spring.datasource.scrm_account.password=jr2vL8Tx spring.datasource.scrm_account.password=jr2vL8Tx
#
#
#spring.datasource.insert.jdbc-url=jdbc:mysql://192.168.5.24:3306/dj_operationreport?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8 spring.datasource.insert.jdbc-url=jdbc:mysql://192.168.5.24:3306/dj_operationreport?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8
#spring.datasource.insert.driver-class-name=com.mysql.jdbc.Driver spring.datasource.insert.driver-class-name=com.mysql.jdbc.Driver
#spring.datasource.insert.username=user_jinglf spring.datasource.insert.username=user_jinglf
#spring.datasource.insert.password=jr2vL8Tx spring.datasource.insert.password=jr2vL8Tx
#
#
#spring.datasource.query.jdbc-url=jdbc:mysql://192.168.5.24:3306/dj_operationreport?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8 spring.datasource.query.jdbc-url=jdbc:mysql://192.168.5.24:3306/dj_operationreport?rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8
#spring.datasource.query.driver-class-name=com.mysql.jdbc.Driver spring.datasource.query.driver-class-name=com.mysql.jdbc.Driver
#spring.datasource.query.username=user_jinglf spring.datasource.query.username=user_jinglf
#spring.datasource.query.password=jr2vL8Tx spring.datasource.query.password=jr2vL8Tx
#
#binlogip=192.168.5.23 binlogip=192.168.5.23
#binlogport=3306 binlogport=3306
#binlogdb=dj_smartcarlife binlogdb=dj_smartcarlife
#binlogusername=user_jinglf binlogusername=user_jinglf
#binlogpassword=jr2vL8Tx binlogpassword=jr2vL8Tx
#
#binlogip2=192.168.5.1 binlogip2=192.168.5.1
#binlogport2=3310 binlogport2=3310
#binlogdb2=scrm_account binlogdb2=scrm_account
#binlogusername2=user_jinglf binlogusername2=user_jinglf
#binlogpassword2=jr2vL8Tx binlogpassword2=jr2vL8Tx
#
##生产环境 #生产环境
#absolutePath =/app/soft/java_project/appletBusinessAnalysis/品牌.json absolutePath =/app/soft/java_project/appletBusinessAnalysis/品牌.json
#apiUrlName=正式 apiUrlName=正式
#whereupgradegoodstypesuppliercode=upgradegoodstypesuppliercode_product whereupgradegoodstypesuppliercode=upgradegoodstypesuppliercode_product
......
  • @wangxw1
    commented
    Master

    一、关键问题与优化建议(仅限 Top 3)

    1. 【安全性】敏感信息(数据库密码)明文硬编码

    • 问题描述:在 application.properties 和 my.properties 中,生产环境的数据库账号、密码(如 jr2vL8Tx)等敏感凭据均以明文形式直接暴露在代码中。这违反了安全规范,极易导致核心资产泄露。
    • 优化建议:禁止将生产环境密码明文提交到代码仓库。建议使用 Jasypt 等工具对配置文件中的密码进行加密,或者通过环境变量(Environment Variables)、配置中心(如 Nacos、Apollo)或 KMS 服务在运行时动态注入敏感配置。

    2. 【可维护性】多环境配置管理方式不当

    • 问题描述:通过手动“注释/取消注释”配置项的方式来切换开发、测试和生产环境。这种做法不仅容易在合并分支时产生冲突,还极易引发人为失误(如误将测试库发布到生产环境)。
    • 优化建议:遵循 Spring Boot 的最佳实践,使用 Profile 机制来分离多环境配置。将配置文件拆分为 application-dev.properties、application-test.properties 和 application-prod.properties,在启动时通过 --spring.profiles.active=prod 或环境变量来激活对应环境的配置。

    3. 【功能健壮性】MySQL 驱动类过时且不统一

    • 问题描述:在 application.properties 中使用了较新的 com.mysql.cj.jdbc.Driver,但在 my.properties 启用的生产环境配置中,大量使用了已过时的 com.mysql.jdbc.Driver。
    • 优化建议:统一将 MySQL 驱动升级并修改为 com.mysql.cj.jdbc.Driver。同时注意,使用新版驱动时,建议在 JDBC URL 中显式指定时区参数(如 serverTimezone=Asia/Shanghai),以避免潜在的数据库时间插入错误。

    二、评分明细

    1. 功能实现的正确性与健壮性(35/40分):驱动配置过时且不统一,可能会在特定 MySQL 版本下引发连接告警或兼容性问题。
    2. 安全性与潜在风险(10/30分):生产环境核心数据库账密明文提交至代码库,存在极高的安全风险,扣分严重。
    3. 最佳实践与可维护性(10/20分):手动注释切换环境的做法不符合现代化工程管理规范,维护成本高且易错。
    4. 性能与资源利用(5/5分):连接池参数(如 rewriteBatchedStatements=true)配置合理,有利于批量操作性能。
    5. 提交信息质量(5/5分):提交信息格式清晰,明确描述了本次变更的意图和具体操作。

    总分:65分

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!