application配置详解

application配置详解

application.yml

server:
  port: 80
  servlet:
    context-path: /
spring:
  application:
    name: applicatin-server
  profiles:
    active: dev

application-dev.yml

spring:
  jackson:
    date-format: yyyy-MM-dd HH:mm:ss
    time-zone: GMT+8
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/db?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false
    username: root
    password: root
    type: com.alibaba.druid.pool.DruidDataSource
    initialSize: 2
    minIdle: 2
    maxActive: 3
    maxWait: 6000
    pool-prepared-statements: true
    max-pool-prepared-statement-per-connection-size: 10
    timeBetweenEvictionRunsMillis: 60000
    minEvictableIdleTimeMillis: 300000
    validationQuery: SELECT 1 FROM DUAL
    testWhileIdle: true
    testOnBorrow: false
    testOnReturn: false
    # 注意:这里有个重复的属性,保留一个即可
    poolPreparedStatements: true
    maxPoolPreparedStatementPerConnectionSize: 20
    filters: stat,wall,log4j
    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000

mybatis:
  typeAliasesPackage: com.hanyuanhun.**.entity
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

mybatis-plus:
  mapper-locations: classpath*:/mappers/**/*.xml

logging:
  config: classpath:logback-spring.xml

transaction:
  rollback-on-commit-failure: true

application-prod.yml

以上是application.ymlapplication-dev.yml文件内容的Markdown格式化展示。注意在实际配置中,poolPreparedStatements属性出现了两次,应当只保留一个。

原文链接 https://www.hanyuanhun.cn | https://node.hanyuanhun.cn

posted @   汉源魂  阅读(6)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示