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. Coursera Deep Learning 2 Improving Deep Neural Networks: Hyperparameter tuning, Regularization and Optimization - week1, Assignment(Regularization)

    声明:所有内容来自coursera,作为个人学习笔记记录在这里. Regularization Welcome to the second assignment of this week. Deep ...

  2. github上face_recognition工程项目实践

    一.安装开发环境 1.安装dlib和相关Python依赖 先下载dlib源码: git clone https://github.com/davisking/dlib.git 编译dlib源码:(可以 ...

  3. 调用kaldi的模型进行解码

    At the moment Kaldi is targeted more at people who are building ASR systems than those who just want ...

  4. git操作远程仓库

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

  5. Django 详解 中间件Middleware

    Django中间件 还是涉及到django的请求生命周期.middle ware 请求穿过中间件到达url,再经过中间件返回给用户. 简单实例 django项目根目录新建一个Middle文件夹,再新建 ...

  6. Python 21 Django 实用小案例1

    实用案例 验证码与验证   KindEditor      组合搜索的实现 单例模式      beautifulsoup4 验证码与验证 需要安装Pillow模块 pip stall pillow ...

  7. python 模块 - pymongo模块

    mongoDB 数据库: pymongo 操作: import pymongo # 连接mongo数据库 client = pymongo.MongoClient(host='localhost', ...

  8. [TensorFlow笔记乱锅炖] tf.multinomial(logits, num_samples)使用方法

    tf.multinomial(logits, num_samples) 第一个参数logits可以是一个数组,每个元素的值可以简单地理解为对应index的选择概率,注意这里的概率没有规定加起来的和为1 ...

  9. linux系统内核版本升级

    一.查看Linux内核版本命令(2种方法): 1.cat /proc/version 2.uname -a 二.查看Linux系统版本的命令(3种方法): 1.lsb_release -a 即可列出所 ...

  10. 【转】Python3 configparse模块(配置)

    [转]Python3 configparse模块(配置) ConfigParser模块在python中是用来读取配置文件,配置文件的格式跟windows下的ini配置文件相似,可以包含一个或多个节(s ...