找回密码
 立即注册
查看: 151|回复: 0

SpringCloud微服务开发与实战之常见配置

[复制链接]

156

主题

5

精华

160

金币

技术维护QQ:515138

积分
345
发表于 2025-12-6 16:15:34 | 显示全部楼层 |阅读模式
SpringCloud微服务开发与实战之常见配置

MyBatisPlus的配置项继承了MyBatis原生配置和一些自己特有的配置。例如:

  1. mybatis-plus:
  2.   type-aliases-package: com.zidiu.mp.domain.po # 别名扫描包
  3.   mapper-locations: "classpath*:/mapper/**/*.xml" # Mapper.xml文件地址,默认值
  4.   configuration:
  5.     map-underscore-to-camel-case: true # 是否开启下划线和驼峰的映射
  6.     cache-enabled: false # 是否开启二级缓存
  7.   global-config:
  8.     db-config:
  9.       id-type: assign_id # id为雪花算法生成
  10.       update-strategy: not_null # 更新策略:只更新非空字段
复制代码
配置:https://www.baomidou.com/reference/

1.jpg
SpringCloud微服务开发与实战
  1. spring:
  2.   datasource:
  3.     url: jdbc:mysql://127.0.0.1:3306/mp?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
  4.     driver-class-name: com.mysql.cj.jdbc.Driver
  5.     username: root
  6.     password: root
  7. logging:
  8.   level:
  9.     com.itheima: debug
  10.   pattern:
  11.     dateformat: HH:mm:ss
  12. # mybatis-plus配置
  13. mybatis-plus:
  14.   type-aliases-package: com.zidiu.mp.domain.po # 别名扫描包
  15.   mapper-locations: "classpath*:/mapper/**/*.xml" # Mapper.xml文件地址,默认值
  16.   configuration:
  17.     map-underscore-to-camel-case: true # 是否开启下划线和驼峰的映射
  18.     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  19.     cache-enabled: false # 是否开启二级缓存
  20.   global-config:
  21.     db-config:
  22.       id-type: auto  # auto自动增长 assign_id为雪花算法生成
  23.       update-strategy: not_null # 更新策略:只更新非空字段
  24. # springdoc-openapi项目配置
  25. springdoc:
  26.   swagger-ui:
  27.     path: /swagger-ui.html
  28.     tags-sorter: alpha
  29.     #operations-sorter: order
  30.   api-docs:
  31.     path: /v3/api-docs
  32.   group-configs:
  33.     - group: 'default'
  34.       display-name: '管理端接口'
  35.       paths-to-match: '/**'
  36.       packages-to-scan: com.itheima.mp.controller
  37. #    - group: 'user'
  38. #      display-name: '用户端接口'
  39. #      paths-to-match: '/user/**'
  40. #      packages-to-scan: com.itheima.controller.user
  41.   # 开启扁平化
  42.   default-flat-param-object: true
复制代码


上一篇:SpringCloud微服务开发与实战之MybatisPlus步骤和常见注解
下一篇:SpringCloud微服务开发与实战之条件构造器wrapper
网站建设,公众号小程序开发,系统定制,软件App开发,技术维护【联系我们】手机/微信:17817817816 QQ:515138

QQ|Archiver|自丢网 ( 粤ICP备2024252464号-1 )

GMT+8, 2026-1-19 13:16

专注于网站建设,公众号小程序制作,商城小程序,系统定制,软件App开发

【联系我们】手机/微信:17817817816 QQ:515138

快速回复 返回顶部 返回列表