SpringCloud微服务开发与实战之常见配置
MyBatisPlus的配置项继承了MyBatis原生配置和一些自己特有的配置。例如:
- mybatis-plus:
- type-aliases-package: com.zidiu.mp.domain.po # 别名扫描包
- mapper-locations: "classpath*:/mapper/**/*.xml" # Mapper.xml文件地址,默认值
- configuration:
- map-underscore-to-camel-case: true # 是否开启下划线和驼峰的映射
- cache-enabled: false # 是否开启二级缓存
- global-config:
- db-config:
- id-type: assign_id # id为雪花算法生成
- update-strategy: not_null # 更新策略:只更新非空字段
复制代码 配置:https://www.baomidou.com/reference/
SpringCloud微服务开发与实战
- spring:
- datasource:
- url: jdbc:mysql://127.0.0.1:3306/mp?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
- driver-class-name: com.mysql.cj.jdbc.Driver
- username: root
- password: root
- logging:
- level:
- com.itheima: debug
- pattern:
- dateformat: HH:mm:ss
-
- # mybatis-plus配置
- mybatis-plus:
- type-aliases-package: com.zidiu.mp.domain.po # 别名扫描包
- mapper-locations: "classpath*:/mapper/**/*.xml" # Mapper.xml文件地址,默认值
- configuration:
- map-underscore-to-camel-case: true # 是否开启下划线和驼峰的映射
- log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
- cache-enabled: false # 是否开启二级缓存
- global-config:
- db-config:
- id-type: auto # auto自动增长 assign_id为雪花算法生成
- update-strategy: not_null # 更新策略:只更新非空字段
-
- # springdoc-openapi项目配置
- springdoc:
- swagger-ui:
- path: /swagger-ui.html
- tags-sorter: alpha
- #operations-sorter: order
- api-docs:
- path: /v3/api-docs
- group-configs:
- - group: 'default'
- display-name: '管理端接口'
- paths-to-match: '/**'
- packages-to-scan: com.itheima.mp.controller
- # - group: 'user'
- # display-name: '用户端接口'
- # paths-to-match: '/user/**'
- # packages-to-scan: com.itheima.controller.user
- # 开启扁平化
- default-flat-param-object: true
复制代码
|