Commit d0aa50da by fangfangyimi

修改 my.properties 配置

1 parent 4e76006a
...@@ -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,50 +142,50 @@ spring.datasource.dj_smartcarlife1.password=jr2vL8Tx ...@@ -142,50 +142,50 @@ spring.datasource.dj_smartcarlife1.password=jr2vL8Tx
#生产环境 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. 配置文件中存在明文硬编码的敏感信息(安全风险 - 高危)

    • 问题描述:配置文件中直接暴露了多个数据库的内网 IP 地址、用户名以及明文密码。这严重违反了《阿里巴巴 Java 开发手册》中关于安全规约的要求(禁止在代码中明文存储密码等敏感数据),极易导致数据泄露。
    • 优化建议:
      • 禁止明文提交:切勿将包含真实账号密码的配置文件提交到代码仓库(Git)。
      • 加密存储或动态注入:建议使用 Jasypt 等工具对密码进行加密,或将配置迁移至配置中心(如 Nacos, Apollo, 阿里云 KMS),也可以在部署部署时通过环境变量(Environment Variables)或启动参数动态注入凭证。

    2. 环境配置隔离与切换方式极不规范(可维护性 - 严重缺陷)

    • 问题描述:通过大段“注释”和“取消注释”来切换测试环境和生产环境的配置。这种做法非常原始且极易出错,多人协作时极大概率会引发合并冲突,甚至导致测试环境直连生产库的重大生产事故。
    • 优化建议:
      • 遵循 Spring Boot 的最佳实践,利用 Profile 机制进行环境隔离。
      • 将配置文件拆分为 application-test.properties(测试环境)和 application-prod.properties(生产环境)。
      • 在基础的 application.properties 中通过 spring.profiles.active=test 来指定当前激活的环境,或直接在应用启动时通过命令行参数 --spring.profiles.active=prod 动态指定。

    3. 使用了过时的 MySQL 驱动类名(功能与健壮性 - 建议修改)

    • 问题描述:配置项 driver-class-name=com.mysql.jdbc.Driver 属于旧版 MySQL 驱动包的类名。在 MySQL Connector/J 6.x 及以上版本中,该类已被标记为废弃(Deprecated)。
    • 优化建议:
      • 建议将其统一修改为 com.mysql.cj.jdbc.Driver。虽然旧类名在部分版本中能通过内部桥接勉强运行并打印警告,但在较新版本的依赖中可能会直接导致驱动加载失败。

    二、评分明细

    • 1. 功能实现的正确性与健壮性(40分):得 30 分。数据库连接参数基本完整,但使用了过时的 JDBC 驱动类名,可能会在未来依赖升级时引发兼容性问题。
    • 2. 安全性与潜在风险(30分):得 5 分。存在极其严重的明文密码和敏感内网 IP 泄露风险,且直接提交至版本控制系统,属于重大安全隐患。
    • 3. 最佳实践与可维护性(20分):得 5 分。通过手动注释代码的方式切换多环境配置,严重违背了现代微服务/Spring Boot 的配置管理最佳实践,可维护性极差。
    • 4. 性能与资源利用(5分):得 5 分。配置了 rewriteBatchedStatements=true 等参数,有助于提升批量操作的性能,该部分表现良好。
    • 5. 提交信息质量(5分):得 2 分。Commit Message "修改 my.properties 配置" 过于宽泛,未能说明修改的上下文和目的(例如:“切换本地调试环境至测试库”)。

    总分:47分

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