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. Codeforces Beta Round #25 (Div. 2 Only)E. Test

    E. Test time limit per test 2 seconds memory limit per test 256 megabytes input standard input outpu ...

  2. (linux)SD卡初始化-mmc_sd_init_card函数(续)

      转自:http://www.cnblogs.com/fengeryi/p/3472728.html   mmc_sd_init_card剩下的关于UHS-I的分支结构. uhs-I的初始化流程图如 ...

  3. LightOJ - 1422 Halloween Costumes —— 区间DP

    题目链接:https://vjudge.net/problem/LightOJ-1422 1422 - Halloween Costumes    PDF (English) Statistics F ...

  4. POJ1077 Eight —— IDA*算法

    主页面:http://www.cnblogs.com/DOLFAMINGO/p/7538588.html 代码一:像BFS那样,把棋盘数组放在结构体中. #include <iostream&g ...

  5. python中PIL.Image和OpenCV图像格式相互转换

    PIL.Image转换成OpenCV格式: import cv2 from PIL import Image import numpy image = Image.open("plane.j ...

  6. 【伪题解】 [Offer收割]编程练习赛58

    [A:最大的K-偏差排列]: 第一次在hiho卡一题,所以暴力了搜索了一下,70分,后面回来打表找规律,规律是有和K有关的周期. 当K<=N/2时,成周期交叉变化,最后尾部部分单独考虑. 当K& ...

  7. [Selenium] 使用Firefox Driver 示例

    //导入Selenium 库和FirefoxDriver 库 package com.learningselenium.simplewebdriver; import org.openqa.selen ...

  8. BZOJ_1295_[SCOI2009]最长距离_dij

    BZOJ_1295_[SCOI2009]最长距离_dij Description windy有一块矩形土地,被分为 N*M 块 1*1 的小格子. 有的格子含有障碍物. 如果从格子A可以走到格子B,那 ...

  9. 单片机和Linux都想学_换个两全的方法学习单片机

    本节教你如何学习单片机,如何选择合适的开发板和开发工具. 现在我们知道单片机是要学习的,那么怎么去学习单片机?在上一课我们说不要使用老一套的方法学习,实际上是指的两个问题. 第一:选择什么开发板: 第 ...

  10. Windows下如何生成数字证书

    1.Makecert.exe<证书创建工具>使用说明:http://msdn.microsoft.com/zh-cn/library/bfsktky3.aspx 2.SignTool.ex ...