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. 51Nod 1089 最长回文子串 V2 —— Manacher算法

    题目链接:https://vjudge.net/problem/51Nod-1089 1089 最长回文子串 V2(Manacher算法) 基准时间限制:1 秒 空间限制:131072 KB 分值:  ...

  2. ORACLE 创建表空间及用户

    /*创建存放原始数据的表空间*/ create tablespace Djzh_original datafile 'E:\APP\ADMINISTRATOR\ORADATA\ORCL\Djzh_or ...

  3. golang OOP面向对象

    摘自:http://www.01happy.com/golang-oop/ golang中并没有明确的面向对象的说法,实在要扯上的话,可以将struct比作其它语言中的class. 类声明 1 2 3 ...

  4. 使用gcc找出头文件的路径

    参考 http://stackoverflow.com/questions/13079650/how-can-i-find-the-header-files-of-the-c-programming- ...

  5. 出现Insufficient space for shared memory file错误解决

    今天在linux下敲命令,出现上面的错误,原来是临时文件目录(/tmp)下的空间不够了,df一看/下100%了.

  6. I.MX6 lcd lvds 注册流程

    /************************************************************************ * I.MX6 lcd lvds 注册流程 * 说明 ...

  7. codeforces round 420 div2 补题 CF 821 A-E

    A Okabe and Future Gadget Laboratory 暴力 #include<bits/stdc++.h> using namespace std; typedef l ...

  8. 使用lsyncd配置数据库备份多异地同步

    lsyncd配置文件 settings { logfile = "/var/log/lsyncd.log", --日志路径 status = "/var/log/lsyn ...

  9. wcf中事务的操作

    using System; using System.ServiceModel; namespace Larryle.Wcf.ServiceContract.Transaction { [Servic ...

  10. eclipse中更改配置使得switch语句不出错

    分别点击: windows---preference--->java---->compiler--->error/waring---->potential programmin ...