首页 > 其他分享 >230119_50_SpringBoot入门

230119_50_SpringBoot入门

时间:2023-01-19 19:57:10浏览次数:33  
标签:230119 properties SpringBoot spring 50 profiles server dev port

  • 多环境配置文件指定

  • 方式一:properites文件

文件名可以是 application-{profile}.properties/yml , 用来指定多个环境版本:

server.port=8081 // test
server.port=8082 // dev
spring.profiles.active=dev

测试结果:

方式一:yaml文件

server:
  port: 8081
#选择要激活那个环境块
spring:
  profiles:
    active: prod

---
server:
  port: 8083
spring:
  profiles: dev #配置环境的名称


---

server:
  port: 8084
spring:
  profiles: prod  #配置环境的名称

注意:如果yml和properties同时都配置了端口,并且没有激活其他环境 , 默认会使用properties配置文件的!

标签:230119,properties,SpringBoot,spring,50,profiles,server,dev,port
From: https://www.cnblogs.com/wcwblog/p/17062041.html

相关文章

  • t团队日常记录 20230119
    今天买了很多菜啊,晚上母亲又拿了几样给我这冰箱。今天还算完成了这个功能了,感觉虽然痛苦并快乐着,有种种困难,包括对程序框架的从陌生到熟悉,也是个过程,包括t团队人员融......
  • 代码随想录day 22 LeetCode 235. 二叉搜索树的最近公共祖先 701. 二叉搜索树中的插入
    235.二叉搜索树的最近公共祖先classSolution{public:TreeNode*lowestCommonAncestor(TreeNode*root,TreeNode*p,TreeNode*q){if(root==NULL)returnNULL......
  • springboot上传下载文件原来这么丝滑
    我使用了hutool的 FileUtil,IdUtil,所以需要引入hutool:<dependency><groupId>cn.hutool</groupId><artifactId>hutool-all</artifactI......
  • SpringBoot @Target、@Retention、@Documented注解简介
    jdk1.5起开始提供了4个元注解:@Target、@Retention、@Documented、@Inherited。何谓元注解?就是注解的注解。在程序开发中,有时候我们需要自定义一个注解,这个自定义注解类就......
  • SpringBoot日志框架分析
    本文简介第一部分,介绍spring-jcl适配各种日志框架的方式第二部分,介绍slf4j适配各种日志框架的方式第三部分,介绍下logback框架的使用及原理 一、spring-jcl分析说......
  • springboot整合es
    pom.xml增加依赖(注意版本要和springboot匹配)<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-st......
  • springboot 热更 2023.3
    热更使用devtools或者alt+shit+f9ideaFile|Settings|Preferences|Build,Execution,Deployment|Compiler:BuildprojectautomaticallyFile|Setting......
  • springboot 常用项目结构
    servicex//项目名|-admin-ui//管理服务前端代码(一般将UI和SERVICE放到一个工程中,便于管理)|-servicex-auth//模块1......
  • SpringBoot(三)
    Swagger、分布式架构部分​​11、Swagger​​​​11.1、Swagger简介​​​​11.2、SpringBoot集成Swagger​​​​11.3、配置Swagger​​​​11.4、Swagger配置扫描接口​​......
  • SpringBoot(二)
    模板引擎、数据源、安全框架部分​​5、SpringBootWeb开发​​​​5.1、静态资源​​​​5.2、首页​​​​5.3、Thymeleaf模板引擎​​​​5.4、装配扩展SpringMVC​​​......