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会从这四个位置全部加载主配置文件;互补配置;

  • 相关阅读:
    人机界面设计
    可用性
    * 产品设计
    界面设计
    原型设计工具——Axure
    原型系统
    交互设计
    原型设计
    Microsoft-PetSop4.0(宠物商店)-数据库设计-Sql
    第1章 游戏之乐——NIM(2)“拈”游戏分析
  • 原文地址:https://www.cnblogs.com/qingmuchuanqi48/p/13193606.html
Copyright © 2011-2022 走看看