# spring-cloud **Repository Path**: noah1_2/spring-cloud ## Basic Information - **Project Name**: spring-cloud - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-07-04 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # spring-cloud #### 项目介绍 spring cloud的demo #### demo说明 #### 端口号: config server:8888 eureka:8000 provider:9001\9002 consumer:9101 #### 整个项目描述的场景: config server 充当配置中心,读取本地(或者git)仓库中配置文件信息 eureka 充当服务的注册中心, provider 服务提供者 consumer 服务消费者 #### 几个注意的地方 #1、yml配置文件的写法有固定的语法结构,用 冒号+空格 为值,就是冒号后面要加个空格 #2、配置中心在读取文件时按照一定的规则去找,application+‘-’+profile,只能读取.properties的文件 #3、yml配置文件和.properties文件的写法区别 ``` server: port: 9000 spring: application: name: spring-cloud-consumer cloud: config: profile:dev uri:http://localhost:8888/ eureka: instance: hostname: localhost client: serviceUrl: defaultZone: http://localhost:8000/eureka/ #tomcat端口号 server.port=8888 #配置文件在本地 spring.profiles.active=native spring.application.name=configserver #配置文件的目录 spring.cloud.config.server.native.search-locations=D:/tmp/cloud/config-repo server: port: 8888 spring: application: name:configserver profiles: active:native cloud: config: server: native: search-locations:file:D:/tmp/cloud/config-repo #文件名 spring.application.name=spring-cloud-provider #文件模式,默认为default spring.cloud.config.profile=dev #server端ip地址 spring.cloud.config.uri= http://localhost:8888/ #client端ip端口 server.port=9001 eureka.instance.hostname=localhost eureka.client.serviceUrl.defaultZone=http://localhost:8000/eureka/ #tomcat端口号 server.port=8888 #配置文件在本地 spring.profiles.active=native spring.application.name=configserver #配置文件的目录 spring.cloud.config.server.native.search-locations=D:/tmp/cloud/config-repo ################################################################# #server: # port: 8888 #spring: # application: # name:configserver # profiles: # active:native # cloud: # config: # server: # native: # search-locations:file:D:/tmp/cloud/config-repo ################################################################# ```