springboot application.yml配置dev_spring boot 环境配置(profile)切换

本文详细介绍了在Spring Boot项目中如何进行环境配置切换,包括使用application.yml配置dev环境,通过设置spring.profiles.active值来选择不同的配置文件,如application-dev.properties等。文章提供了创建简单Spring Boot项目并实现接口展示当前环境的方法,以及通过Eclipse运行和Postman测试接口的步骤。
摘要由CSDN通过智能技术生成

章节

  • Spring Boot 介绍
  • Spring Boot 开发环境搭建(Eclipse)
  • Spring Boot Hello World (restful接口)例子
  • spring boot 连接Mysql
  • spring boot配置druid连接池连接mysql
  • spring boot集成mybatis(1)
  • spring boot集成mybatis(2) – 使用pagehelper实现分页
  • spring boot集成mybatis(3) – mybatis generator 配置
  • spring boot 接口返回值封装
  • spring boot输入数据校验(validation)
  • spring boot rest 接口集成 spring security(1) – 最简配置
  • spring boot rest 接口集成 spring security(2) – JWT配置
  • spring boot 异常(exception)处理
  • spring boot 环境配置(profile)切换
  • spring boot redis 缓存(cache)集成

概述

本文介绍spring boot项目中环境配置切换的过程。

在实际的项目开发中,经常需要不同的环境配置,如开发时不能直接连生产环境的数据库,而上线时就需要连生产环境的数据库。这就要求项目能够切换环境配置。

spring boot项目中,application.properties是配置文件,实际上我们还可以引入不同环境的配置文件,如:application-dev.properties

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值