zoukankan      html  css  js  c++  java
  • SpringBoot多profile文件配置

    1、多Profile文件

    我们在主配置文件编写的时候,文件名可以是 application-{profile}.properties/yml
    默认使用application.properties的配置;

    2、yml支持多文档块方式

    server:
    port: 8081
    spring:
    profiles:
    active: prod
    ‐‐‐
    server:
    port: 8083
    spring:
    profiles: dev
    ‐‐‐
    server:
    port: 8084
    spring:
    profiles: prod #指定属于哪个环境

    3、激活指定profile

    1、在配置文件中指定 spring.profiles.active=dev

    2、命令行:
    java -jar spring-boot-02-config-0.0.1-SNAPSHOT.jar --spring.profiles.active=dev;


    4、配置文件加载位置

    springboot 启动会扫描以下位置的application.properties或者application.yml文件作为Spring boot的默认配置文件

    –file:./config/
    –file:./
    –classpath:/config/
    –classpath:/
    优先级由高到底,高优先级的配置会覆盖低优先级的配置;

    SpringBoot会从这四个位置全部加载主配置文件;互补配置;

  • 相关阅读:
    Zend Studio 9.0.2破解文件和注册码下载
    shell之netstat命令
    shell之arp命令
    Linux网络运维相关
    Linux静态ip设置及一些网络设置
    shell之进程
    shell之小知识点
    软连接与硬链接
    shell之dialog提示窗口
    Linux特殊权限位
  • 原文地址:https://www.cnblogs.com/qingmuchuanqi48/p/13193606.html
Copyright © 2011-2022 走看看