SpringBoot Profile 多环境配置

简介: SpringBoot Profile 多环境配置

SpringBoot Profile 多环境配置


多配置文件配置(properties):格式: applicatino-{profile}.properties

默认: applicatino.properties开发: applicatino-dev.properties生产: applicatino-prod.properties


激活配置:

spring.profiles.active=dev
复制代码


多文档块配置(yml)

server:  
   port: 9090
spring:
   profiles:
     active; dev
---
server:  
   port: 9091
spring:
   profiles: dev 
---
server:  
   port: 9092
spring:
   profiles: prod
复制代码


Idea激活指定环境配置:Idea->Run/Debug Configuration->Program arguments:

--spring.profiles.active=dev
复制代码


Idea虚拟机参数Idea->Run/Debug Configuration->VM options

--Dspring.profiles.active=dev
复制代码


命令行激活指定环境配置:

java -jar xxx.jar --spring.profiles.active=dev



相关文章
|
Java 测试技术 数据库
SpringBoot:@Profile注解和Spring EL
SpringBoot:@Profile注解和Spring EL
224 2
|
Java 测试技术 数据库
详解SpringBoot中的profile
详解SpringBoot中的profile
165 0
|
Java 应用服务中间件 Maven
解析Spring Boot中的Profile:配置文件与代码的双重掌控
解析Spring Boot中的Profile:配置文件与代码的双重掌控
|
算法 Java 测试技术
SpringBoot@Profile详解
SpringBoot@Profile详解
675 0
|
Java 测试技术 开发者
springboot学习四:Spring Boot profile多环境配置、devtools热部署
这篇文章主要介绍了如何在Spring Boot中进行多环境配置以及如何整合DevTools实现热部署,以提高开发效率。
650 2
|
Java Spring
深入理解Spring Boot中的Profile配置
深入理解Spring Boot中的Profile配置
|
Java
SpringBoot中的profile的使用
SpringBoot中的profile的使用
231 0
|
Java Spring
SpringBoot中多Profile使用与切换
SpringBoot中多Profile使用与切换
277 0
|
Java Spring
Spring Boot 启动报错解决:No active profile set, falling back to default profiles: default
Spring Boot 启动报错解决:No active profile set, falling back to default profiles: default
868 0
|
Java
07 SpringBoot之Profile文件
07 SpringBoot之Profile文件
119 0