1、修改application.yml配置文件

spring:
  profiles:
    active: cppdy
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8
    username: root
    password: root
  thymeleaf:
    mode: HTML5
    encoding: UTF-8
    content-type: text/html
name: cppdy123

2、创建application-cppdy.yml配置文件

name: cppdy222

3、访问测试方法读取的是application-cppdy.yml中的name值

SpringBoot多环境区分的更多相关文章

  1. SpringBoot学习笔记(八):SpringBoot启动端口+访问路、SpringBoot配置文件yml、SpringBoot多环境区分、SpringBoot打包发布

    SpringBoot启动端口+访问路径 配置文件: server.port=9090 server.context-path=/springboot 现在只能用http://127.0.0.1:909 ...

  2. springboot 不同环境不同的配置

    前言 我们在开发Spring Boot应用时,通常同一套程序会被应用和安装到几个不同的环境,比如:开发.测试.生产等.其中每个环境的数据库地址.服务器端口等等配置都会不同,如果在为不同环境打包时都要频 ...

  3. spring-boot 根据环境启动

    spring-boot 根据环境启动: java -jar spring-boot--config--SNAPSHOT.jar --spring.profiles.active=prod

  4. SpringBoot 多环境配置

    转载:https://www.cnblogs.com/gdpuzxs/p/7191436.html 在我们的实际开发中,一般都有三套环境,开发环境,测试环境,生产环境,三套环境的数据库连接配置也有所不 ...

  5. springboot 多环境配置yml或properties

    https://www.cnblogs.com/mr-yang-localhost/p/8971327.html   springboot 多环境配置 https://blog.csdn.net/li ...

  6. spring-boot多环境配置文件

    spring-boot多环境配置文件 目录 配置 多环境配置文件名称要遵循格式 application-{profile}.yml application.yml spring: profiles: ...

  7. springboot多环境配置

    springboot多环境(dev.test.prod)配置 2017-07-17 10:33 1290人阅读 评论(0) 收藏 举报  分类: spring boot(6)  版权声明:本文为博主原 ...

  8. 我的spring-boot开发环境

    我的spring-boot开发环境,目的方便我快速搭建开发环境,同时可以最佳实践.使用spring-boot 2.1.x. 代码地址:GitHub my-springboot-examples 目的是 ...

  9. springboot 多环境

    springboot 多环境 --spring.profiles.active=dev 查看 Ioc 容器 PostProcessorRegistrationDelegate

随机推荐

  1. 第26月第30天 srt

    1. ffmpeg -i 0.mp4 -vf subtitles=0.srt 1.mp4 https://jingyan.baidu.com/article/c45ad29c73cef2051653e ...

  2. 03-13_static关键字

    static主要作用 常见定义结构:public static void main(): static关键字可以用于定义属性及方法: static定义属性 在一个类之中,主要的组成就是属性和方法(分为 ...

  3. NPOI 设置样式为粗体

    CellStyle style = hssfworkbook.CreateCellStyle(); Font f = hssfworkbook.CreateFont(); f.Boldweight = ...

  4. day 8 - 2 文件操作练习

    注册登录 需求: 1.对账号密码的长度进行限制并不允许出现特殊字符 2.把账号密码储存进文件中 3.密码最多输入错误三次 #分别判断注册时账号密码的长度与特殊字符 flag=1 while flag: ...

  5. 异步Async

    1.c#异步介绍 异步必须基于委托,有委托才有异步 新建一个window Form程序MyAsync,添加一个按钮,(name)=btnAsync 后台代码如下: using System;using ...

  6. H - Rescue the Princess ZOJ - 4097 (tarjan缩点+倍增lca)

    题目链接: H - Rescue the Princess  ZOJ - 4097 学习链接: zoj4097 Rescue the Princess无向图缩点有重边+lca - lhc..._博客园 ...

  7. Content-disposition中Attachment和inline的区别

    1.Content-disposition中Attachment和inline的区别java web中下载文件时,我们一般设置Content-Disposition告诉浏览器下载文件的名称,是否在浏览 ...

  8. Gulp简明使用教程

    Glup用自动化构建工具增强你的工作流程! 同类型的软件还有Grunt.关于两者的区别可以参考这篇文章Grunt VS Gulp 安装: $ npm install gulp -g $ npm ins ...

  9. 20165337岳源 第四次实验 Android开发

    1.实验要求: 参考<Java和Android开发学习指南(第二版)(EPUBIT,Java for Android 2nd)>第二十四章 参考http://www.cnblogs.com ...

  10. 用多线程处理FTP上传

    在开发中遇到总站发送命令请求分站将某资源通过FTP上传过来,也就是总站提取分站的资源问题.并且总站实时可以获取已经提取了文件的大小的比例. 思路:1.首先分站要将文件大小告知总站 2.总站收到文件大小 ...