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. 快速安装nginx

    1.创建nignx用户 /usr/sbin/groupadd -f nginx /usr/sbin/useradd -g nginx nginx 2.安装依赖 yum install gcc gcc- ...

  2. git操作远程仓库

    1.在本地电脑的上生成ssh-key ssh-keygen -t rsa -C "youremail@126.com" 可以在用户主目录里找到.ssh目录,里面有id_rsa和id ...

  3. Codeforces891C(892E)

    传送门:here 简述题意:                                                                                       ...

  4. 【Thymeleaf】Thymeleaf模板对html实时刷新

    解决方案 spring: thymeleaf: cache: false 修改完html代码后Ctrl+Shift+F9,重新编译即可刷新页面内容!

  5. eclipse中一些常见svn图标的含义

    项目视图   The Package Explorer view - 已忽略版本控制的文件.可以通过Window → Preferences → Team → Ignored Resources.来忽 ...

  6. MySql cmd下的学习笔记 —— 有关视图的操作(建立表)

    在查询中,我们经常把查询结果当成临时表 view可以看成是一张虚拟表,是表通过某种运算得到的一个投影 在建立视图时,不需要指定视图的列名与列类型 红框内的为select选择语句 蓝框内的与建表语句类似 ...

  7. shell编程 之 echo命令和printf命令

    1 echo命令基本情况: echo显示普通字符:echo "i am studying shell"(有木有引号都可以) 支持转义字符:echo "\"hel ...

  8. [python] 基础工具介绍好文推荐

    Github上有个哥们写的,还不错,mark一下: https://github.com/lijin-THU/notes-python/blob/master/index.ipynb 相对全面的介绍了 ...

  9. Mudo C++网络库第五章学习笔记

    高效的多线程日志 日志(logging)有两个意思: 诊断日志(diagnostic log), 常用日志库提供日志功能; 交易日志(transaction log), 用于记录状态变更, 通过回放日 ...

  10. 029_shell编写工作常用工具类总结

    一.检查命令的执行结果 function check_result() { result=$? flag=$1 if [[ "$result"x == "0"x ...