springboot application.yml配置

1.总配置文件(其中都有注释)

#公共配置
server:
    port: 80
    tomcat:
      uri-encoding: UTF-8

spring:
    #激活哪一个环境的配置文件
    profiles:
      active: dev
    #视图配置
    mvc:
      static-path-pattern: /static/**
    aop:
      proxy-target-class: true
#    devtools:
#      restart:
#        enabled: true  #设置开启热部署
#        additional-paths: src/main/java #重启目录
#        exclude: WEB-INF/**
    thymeleaf:
      cache: false
  #    datasource:
#        jdbc-url: jdbc:mysql://localhost:3306/comadmin?useUnicode=true&characterEncoding=utf8
#        username: root
#        password: forever10000
#        driver-class-name: com.mysql.jdbc.Driver
#        maximum-pool-size: 30
    datasource:
        url: jdbc:oracle:thin:@192.168.137.200:1521:orcl
        username: sjzhc
        password: sjzhc
        driver-class-name: oracle.jdbc.driver.OracleDriver
        maximum-pool-size: 30

#mybatisPlu
mybatis-plus:
  mapper-locations: classpath:/mapper/**/*Mapper.xml
  typeAliasesPackage: com.kexin.admin.entity.table
  global-config:
    key-generator:
      com.baomidou.mybatisplus.incrementer.OracleKeyGenerator
    db-config:
      #主键类型 mysql  AUTO:"数据库ID自增", INPUT:"用户输入ID",ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
      #主键类型  oracle 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)",
#      id-type: AUTO
      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
      id-type: 1
      # Sequence序列接口实现类配置
#      key-generator: com.baomidou.mybatisplus.incrementer.OracleKeyGenerator

#      id-type: UUID
       #字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断"
      field-strategy: not_empty
      #驼峰下划线转换
      column-underline: true
      db-type: oracle
#      db-type: mysql
    #刷新mapper
    refresh-mapper: true
  #原生配置
  configuration:
    #开启驼峰功能
    map-underscore-to-camel-case: true
    cache-enabled: false
    jdbc-type-for-null: varchar

#日志
logging:
  config: classpath:logback.xml
  path: D:\logs\comadmin




---
#开发环境配置
spring:
  profiles: dev
  #自定义配置属性
  #视图配置
  mvc:
    static-path-pattern: /static/**
  aop:
    proxy-target-class: true
#  datasource:
#      url: jdbc:mysql://localhost:3306/comadmin?useUnicode=true&characterEncoding=utf8
#      username: root
#      password: forever10000
#      driver-class-name: com.mysql.jdbc.Driver
#      maximum-pool-size: 30
  datasource:
      url: jdbc:oracle:thin:@192.168.137.200:1521:orcl
      username: sjzhc
      password: sjzhc
      driver-class-name: oracle.jdbc.driver.OracleDriver
      maximum-pool-size: 30

server:
  #端口
  port: 80



---
#测试环境配置
spring:
  profiles: test
  #自定义配置属性
  #视图配置
  mvc:
    static-path-pattern: /static/**
  aop:
    proxy-target-class: true
  datasource:
    url: jdbc:mysql://localhost:3306/comadmin?useUnicode=true&characterEncoding=utf8
    username: root
    password: cmh199410
    driver-class-name: com.mysql.jdbc.Driver
    maximum-pool-size: 30
server:
  #端口
  port: 8085


---
#生产环境配置
spring:
  profiles: pro
  datasource:
    url: jdbc:mysql://localhost:3306/comadmin?useUnicode=true&characterEncoding=utf8
    username: root
    password: cmh199410
    driver-class-name: com.mysql.jdbc.Driver
    maximum-pool-size: 30
server:
  port: 8080

 

springboot application.yml配置

上一篇:Android常见输入法的包名和主类名


下一篇:Vue中的网络应用 axios