ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

项目配置yaml

2022-04-24 11:02:10  阅读:40  来源: 互联网

标签:stat 项目 配置 druid yaml plus mybatis true log4j


springboot的一些配置

#当循环调用时,就会报错
spring.main.allow-circular-references=true
#配置mvc是需要使用一个@EnableWebMvc,不使用添加下面的配置即可
spring.mvc.pathmatch.matching-strategy=ant_path_matcher
#开启驼峰命名
mybatis-plus.configuration.map-underscore-to-camel-case=true
#mybatis-plus   开启与关闭 SQL 日志打印,后面是前缀
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
mybatis-plus.global-config.db-config.table-prefix=ms_
spring:
  datasource:
    username: root
    password: admin
    #?serverTimezone=UTC解决时区的报错
    url: jdbc:mysql://localhost:3306/mybatis?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8
    driver-class-name: com.mysql.cj.jdbc.Driver
    type: com.alibaba.druid.pool.DruidDataSource


    #Spring Boot 默认是不注入这些属性值的,需要自己绑定
    #druid 数据源专有配置
    initialSize: 5
    minIdle: 5
    maxActive: 20
    maxWait: 60000
    timeBetweenEvictionRunsMillis: 60000
    minEvictableIdleTimeMillis: 300000
    validationQuery: SELECT 1 FROM DUAL
    testWhileIdle: true
    testOnBorrow: false
    testOnReturn: false
    poolPreparedStatements: true

    #配置监控统计拦截的filters,stat:监控统计、log4j:日志记录、wall:防御sql注入
    #如果允许时报错  java.lang.ClassNotFoundException: org.apache.log4j.Priority
    #则导入 log4j 依赖即可,Maven 地址:https://mvnrepository.com/artifact/log4j/log4j
    filters: stat,wall,log4j
    maxPoolPreparedStatementPerConnectionSize: 20
    useGlobalDataSourceStat: true
    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
   

mybatis:
  type-aliases-package: nuc.ss.pojo
  mapper-locations: classpath:mapper/*.xml

标签:stat,项目,配置,druid,yaml,plus,mybatis,true,log4j
来源: https://www.cnblogs.com/rain-me/p/16184832.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有