springboot多环境开发兼容问题(Maven和boot)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.itheima</groupId>
<artifactId>springboot_05_maven_and_boot_profile</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>springboot_05_maven_and_boot_profile</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- 对资源文件开启对默认占位符的解析-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<useDefaultDelimiters>true</useDefaultDelimiters>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<!-- 开发环境-->
<profile>
<id>dev</id>
<properties>
<profile.active>dev</profile.active>
</properties>
</profile>
<!--生产环境-->
<profile>
<id>pro</id>
<properties>
<profile.active>pro</profile.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<!-- 测试环境-->
<profile>
<id>test</id>
<properties>
<profile.active>test</profile.active>
</properties>
</profile>
</profiles>
</project>
在maven中设置多环境,在SpringBoot中的配置文件中.yml中应用maven属性
#设置启用的环境
spring:
profiles:
active: ${profile.active}
---
#开发
spring:
profiles: dev
server:
port: 80
---
#生产
spring:
profiles: pro
server:
port: 81
---
#测试
spring:
profiles: test
server:
port: 82
springboot多环境开发兼容问题(Maven和boot)的更多相关文章
- 项目开发中的pro、pre、test、dev环境及SpringBoot多环境配置
一.介绍: pro:生产环境,面向外部用户的环境,连接上互联网即可访问的正式环境. pre:灰度环境,外部用户可以访问,但是服务器配置相对低,其它和生产一样. test:测试环境,外部用户无法访问,专 ...
- Java开发学习(三十七)----SpringBoot多环境配置及配置文件分类
一.多环境配置 在工作中,对于开发环境.测试环境.生产环境的配置肯定都不相同,比如我们开发阶段会在自己的电脑上安装 mysql ,连接自己电脑上的 mysql 即可,但是项目开发完毕后要上线就需要该配 ...
- springboot多模块开发以及整合dubbo\zookeeper进行服务管理
之前研究了springboot单工程的使用,参考git地址:https://github.com/qiao-zhi/springboot-ssm 下面研究springboot多模块开发的过程. 1.模 ...
- 【SpringBoot】14. SpringBoot多环境配置
SpringBoot多环境配置 Spring Boot 1.5.19.RELEASE 假设项目中需要3个环境--开发.测试.生产 profile :代表的就是一个环境变量 语法结构:applicati ...
- springboot+mybatis+bootstrap开发员工oa后台管理系统项目源码
java项目源码详情描述:S020<springboot+mybatis+bootstrap开发员工oa后台管理系统项目源码>jboa项目有请假以及报销单的申请和审核session共享加登 ...
- 菜鸟学自动化测试(八)----selenium 2.0环境搭建(基于maven)
菜鸟学自动化测试(八)----selenium 2.0环境搭建(基于maven) 2012-02-04 13:11 by 虫师, 11419 阅读, 5 评论, 收藏, 编辑 之前我就讲过一种方试来搭 ...
- IntelliJ IDEA 开发工具项目maven管理
今天自己重新部署一下intellij下的项目开发环境,顺便把maven管理项目jar包的方法梳理一下 (1)首先下载apache-maven-3.0.4版本的maven,我自己解压在D:\maven\ ...
- 使用 Java 开发兼容 IPv6 的网络应用程序
根据现有 IPv4 地址的部署速度,剩余的地址将在 10 到 20 年被使用殆尽.因此网络逐渐从 IPv4 向 IPv6 转换是不可避免的,相应的各种网络应用程序都将支持 IPv6.对于 Java,从 ...
- SpringBoot学习(七)-->SpringBoot在web开发中的配置
SpringBoot在web开发中的配置 Web开发的自动配置类:在Maven Dependencies-->spring-boot-1.5.2.RELEASE.jar-->org.spr ...
- ASP.Net在64位环境开发部署常见问题
越来越多的开发团队開始使用64位操作系统作为开发环境,也计划将应用部署在安装有64位操作系统的server上.对于ASP.Net开发人员来说.使用64位环境开发部署须要注意下面几个问题.可在项目过程中 ...
随机推荐
- https://ghproxy.com/ 下载代理
https://github.com/microsoft/PowerToys/releases/tag/v0.58.0 https://github.com/jgraph/drawio-desktop ...
- sign签名
$sign = array( 'ip'=>'1.15.23.31' // array('ip'=>'2.34.45.34'), ); $ip = setSign($sign); for ( ...
- Hive. 函数 instr 的用法
INSTR(C1,C2,I,J) 在一个字符串中搜索指定的字符,返回发现指定的字符的位置; C1 被搜索的字符串 C2 希望搜索的字符串 I 搜索的开始位置,默认为1 J 出现的位置,默认为1 sel ...
- Hackintool查看CFG锁显示空白
Hackintool是黑苹果配置的得力工具,通过在Hackintool > 工具 > 从AppleIntelInfo中获取 可以看到cfg是否成功解锁.但是如果点击该按钮后输入密码执行CP ...
- bzoj 2594
很好的一道LCT题目 首先我们可以发现,题目要求的就是最小生成树上的一条树链的最长边的长度,因此我们实际只需动态维护最小生成树即可 然后我们考虑怎么动态维护最小生成树 不难发现,如果涉及在最小生成树上 ...
- count(1) and count(*),count(字段)区别及效率比较
执行结果: count(1)和count(*)之间没有区别,因为count(*)count(1)都不会去过滤空值, count(字段) 会统计该字段在表中出现的次数,忽略字段为null 的情况.即不统 ...
- JS通用公共函数
function formatTime(time) { if (typeof time !== 'number' || time < 0) { return time } var hour = ...
- 记录一次 网关负载 流量不均匀 cpu使用率不均衡问题
网关负载 流量不均匀 cpu使用率不均衡问题??? 1.压力机访问源 有多少ip 有10个? 还是20个? 就是样本源不多的话,负载上hash的话 就你可能不是真实的访问需求 ,你客户端就那么 ...
- windows根据文件名找到进程,并杀死进程。
背景:最近因为工作原因,装了360杀毒引擎,完了就卸载了.发现一直提示文件正在使用无法删除.文件无法访问等等.经过一系列操作,安全模式下都无法删除,恶心死了... 1.shirt + del 按文件夹 ...
- hbuliter x 连接雷电模拟器
adb 路径 E:\HBuilderX\plugins\launcher\tools\adbs 也可以配置环境变量 配置环境变量:将adb.exe所在路径,放在Path中计算机(右键)→属性→高级系 ...