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位环境开发部署须要注意下面几个问题.可在项目过程中 ...
随机推荐
- Pod资源的基础管理操作(Kubernetes)
Pod是Kubernetes API中的核心资源类型,它可以定义在JSON或者YAML格式的资源清单中,由资源管理命令进行陈述式声明管理.创建时通过create或apply命令将请求提交到API Se ...
- 利用python脚本统计和删除redis key
该脚本扫描redis中所有的key,用于分析redis内存数据的key构成,扫描并保存文件,需要python支持redis模块. #!/usr/bin/env python # -*- coding: ...
- Spring入门之spring 概述(01)
1.1 spring 概述 1.1.1 spring 是什么 Spring 是分层的 Java SE/EE 应用 full-stack 轻量级开源框架,以 IoC(Inverse Of Control ...
- Maven常用参数及其说明
Maven常用参数及其说明 -h,--help Display help information-am,--also-make 构建指定模块,同时构建指定模块依赖的其他模块;-amd,--also-m ...
- Unity 2D 记录
Unity 2D 记录 1. 环境配置 1.1 下载安装unity hub和vs code 搜索unity hub 进行下载 https://unity.com/download 安装vs code ...
- 接口返回JSON字符串压缩和解压
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.IO;usi ...
- 高并发解决方案之 redis 分布式锁
背景:秒杀服务中要写一个定时任务:活动到期时给order微服务发送关闭订单的通知.这需要改变数据库表中的数据,而集群中服务是多节点的方式进行部署,会出现并发执行的情况,所以采用的redis的分布式锁的 ...
- 关于Lua中的面向对象实现
写在前面 最近在琢磨"Lua热重载",在测试中发现我之前对Lua中的面向对象实现有一些理解发生变化,这里记录一下. 本文提到的面向对象实现来自云风. 类实现 <Lua程序设计 ...
- test.sh 监听进程是否存在
监听myloader进程是否结束,结束后把时间输出到 /root/time.log vim test.sh #!/bin/bash #确保PRO查询进程唯一 PRO="myloader&qu ...
- Docker安装一些软件
1.Docker开始远程访问 vim /lib/systemd/system/docker.service 在ExecStart的值最最后面追加:空格+-H tcp://0.0.0.0:2375 sy ...