server端配置

POM文件

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.31</version>
</dependency>

配置文件

properties.yml

server:
port: 9000

spring:
application:
name: config-server-jdbc
cloud:
config:
profile: jdbc # 使用jdbc作为配置文件
label: master
server:
jdbc:
sql: SELECT `key`,`value` from config_properties where application_name=? and profile=? and lable=? # sql
refresh:
refreshable: none # 使用Jdbc作为配置文件会造成循环依赖,使用此注解可解决问题
profiles:
active: jdbc #默认文件类型 jdbc

datasource:
driver-class-name: com.mysql.jdbc.Driver
username: root
password: root
url: jdbc:mysql://localhost:3306/spring_cloud
# main:
# allow-bean-definition-overriding: true 使用Jdbc作为配置文件会造成循环依赖,使用此注解可解决问题

config Client

POM文件

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>

配置文件

spring cloud config 的配置文件需要提前加载所以需要在resources目录下新建文件bootstrap.yml文件

spring:
profiles:
active: dev # 默认加载配置文件
application:
name: config
cloud:
config:
uri: http://localhost:9000 # 配置服务器地址
name: ${spring.application.name} # application Name
profile: ${spring.profiles.active} # 那个类型的配置为文件

使用mysql作为配置文件的地址的更多相关文章

  1. 修改mysql数据存储的地址

    修改mysql数据存储的地址 修改步骤如下 1,修改前为默认路径/var/lib/mysql/,计划修改为/data/mysql/data mysql> show variables like ...

  2. Mysql数据库配置文件my.cnf详解

    basedir = path 使用给定目录作为根目录(安装目录). character-sets-dir = path 给出存放着字符集的目录. datadir = path 从给定目录读取数据库文件 ...

  3. mysql 监听ip地址修改

    如何修改MySQL监听IP地址 Mysql默认在本地环路地址127.0.0.1的3306端口监听,要使用其它IP地址需要修改配置文件. 1.编辑/etc/my.cnf 在[mysqld]节中增加下面一 ...

  4. MySQL Cluster 配置文件(config.ini)详解

    MySQL Cluster 配置文件(config.ini)详解 ################################################################### ...

  5. 部署openstack的官网文档解读mysql的配置文件

    部署openstack的官网文档解读mysql的配置文件(使用与ubutu和centos7等系统) author:headsen chen  2017-10-12 16:57:11 个人原创,严禁转载 ...

  6. MySQL读取配置文件的顺序、启动方式、启动原理

    一.MySQL读取配置文件的顺序 读取顺序:/etc/my.cnf > /etc/mysql/my.cnf > /usr/etc/my.cnf > ~/.my.cnf 命令验证:[r ...

  7. [转]关于Linux安装mysql默认配置文件位置

    本文转自:https://blog.csdn.net/smile___you/article/details/54409073 在linux下面安装mysql如果在/etc下面没有存在my.cnf配置 ...

  8. mysql参数配置文件

    (1)参数配置文件中的内容以键值对形式存在. (2)如何查看键值对?show variables like '%name%';或者查看information_schema库下的global_varia ...

  9. MySQL怎样存储IP地址 IP转数字 互转

    MySQL怎样存储IP地址 - cn三少 - 博客园 https://www.cnblogs.com/cnsanshao/p/3326648.html

随机推荐

  1. html5--6-4 CSS选择器

    html5--6-4 CSS选择器 实例 学习要点 掌握常用的CSS选择器 了解不太常用的CSS选择器 什么是选择器 当我们定义一条样式时候,这条样式会作用于网页当中的某些元素,所谓选择器就是样式作用 ...

  2. C语言变量声明问题——变量定义一定要放在所有执行语句/语句块的最前面吗?

    报错信息:error C2065: 'salary' : undeclared identifier #include <stdio.h> void main(){ printf(&quo ...

  3. 【转载】浅谈Excel开发:一 Excel 开发概述

    博客园就是好,想要什么都给总结了,多谢 原文转载:http://www.cnblogs.com/yangecnu/p/Excel-Develpment-Introduction.html 做Offic ...

  4. iOS 生成随机数

    arc4random 1.获取一个随机整数范围在:[0,100)包括0,不包括100 int x = arc4random() % 100; 2.  获取一个随机数范围在:[500,1000],包括5 ...

  5. Android「后台下载」Feb.24小记

    参考了CSDN上的这个文章(HERE),之前只是新开一个线程: public class DownloadThread implements Runnable{ String tarFile ; pu ...

  6. MyBatis学习 之 三、SQL语句映射文件(2)增删改查、参数、缓存

    2.2 select 一个select 元素非常简单.例如: <!-- 查询学生,根据id --> <select id="getStudent" paramet ...

  7. Android Studio自动生成带系统签名的apk

    介绍签名的两种方式: 1.signapk.jar命令行方式: 如果你需要开发一个带有系统权限的app,往往需要配置SharedUserId,比如: </pre><pre name=& ...

  8. Darwin Streaming Server 核心代码分析

    基本概念 首先,我针对的代码是Darwin Streaming Server 6.0.3未经任何改动的版本. Darwin Streaming Server从设计模式上看,采用了Reactor的并发服 ...

  9. 模态对话框 DoModal的用法 (vs2008)与非模态对话框

    Windows对话框分为两类:模态对话框和非模态对话框. 模态对话框,当它弹出后,本应用程序其他窗口将不再接受用户输入,只有该对话框响应用户输入,在对它进行相应操作退出后,其他窗口才能继续与用户交互. ...

  10. Table View Programming Guide for iOS---(三)----Overview of the Table View API

    Overview of the Table View API 表格视图API概述 The table view programming interface includes several UIKit ...