Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringCloud-study
提交
437f9531
S
SpringCloud-study
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
SpringCloud-study
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringCloud-study
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
437f9531
编写于
1月 10, 2023
作者:
Q
qinyingjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:config高可用
上级
ffd60f0b
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
65 addition
and
14 deletion
+65
-14
pom.xml
pom.xml
+1
-1
springcloud-service-config-client/pom.xml
springcloud-service-config-client/pom.xml
+14
-3
springcloud-service-config-client/src/main/java/com/kwan/springcloud/ConfigClientApplication.java
...in/java/com/kwan/springcloud/ConfigClientApplication.java
+4
-3
springcloud-service-config-client/src/main/java/com/kwan/springcloud/controller/ConfigClientController.java
...m/kwan/springcloud/controller/ConfigClientController.java
+9
-1
springcloud-service-config-client/src/main/resources/bootstrap.yml
...ud-service-config-client/src/main/resources/bootstrap.yml
+24
-0
springcloud-service-config-client/src/test/java/com/kwan/springcloud/PortalApplicationTests.java
...est/java/com/kwan/springcloud/PortalApplicationTests.java
+0
-0
springcloud-service-config-get/src/main/resources/bootstrap.properties
...ervice-config-get/src/main/resources/bootstrap.properties
+0
-5
springcloud-service-config/pom.xml
springcloud-service-config/pom.xml
+4
-0
springcloud-service-config/src/main/java/com/kwan/springcloud/ConfigApplication.java
...src/main/java/com/kwan/springcloud/ConfigApplication.java
+2
-0
springcloud-service-config/src/main/resources/application.yaml
...gcloud-service-config/src/main/resources/application.yaml
+7
-1
springcloud-service-config/src/main/resources/bootstrap.properties
...ud-service-config/src/main/resources/bootstrap.properties
+0
-0
未找到文件。
pom.xml
浏览文件 @
437f9531
...
...
@@ -31,7 +31,7 @@
<module>
springcloud-service-common
</module>
<module>
springcloud-service-portal
</module>
<module>
springcloud-service-config
</module>
<module>
springcloud-service-config-
ge
t
</module>
<module>
springcloud-service-config-
clien
t
</module>
<module>
springcloud-service-feign
</module>
<module>
springcloud-service-eureka
</module>
</modules>
...
...
springcloud-service-config-
ge
t/pom.xml
→
springcloud-service-config-
clien
t/pom.xml
浏览文件 @
437f9531
...
...
@@ -7,9 +7,9 @@
<artifactId>
springcloud-service-parent
</artifactId>
<version>
1.0.0
</version>
</parent>
<artifactId>
springcloud-service-config-
ge
t
</artifactId>
<artifactId>
springcloud-service-config-
clien
t
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<name>
springcloud-service-config-
ge
t
</name>
<name>
springcloud-service-config-
clien
t
</name>
<properties>
<java.version>
1.8
</java.version>
</properties>
...
...
@@ -27,8 +27,19 @@
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-
starter-config
</artifactId>
<artifactId>
spring-cloud-
config-client
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
</dependencies>
<build>
...
...
springcloud-service-config-
get/src/main/java/com/kwan/springcloud/ConfigGe
tApplication.java
→
springcloud-service-config-
client/src/main/java/com/kwan/springcloud/ConfigClien
tApplication.java
浏览文件 @
437f9531
...
...
@@ -2,14 +2,15 @@ package com.kwan.springcloud;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.netflix.eureka.EnableEurekaClient
;
@EnableEurekaClient
@SpringBootApplication
public
class
Config
Ge
tApplication
{
public
class
Config
Clien
tApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Config
Ge
tApplication
.
class
,
args
);
SpringApplication
.
run
(
Config
Clien
tApplication
.
class
,
args
);
}
}
springcloud-service-config-
get/src/main/java/com/kwan/springcloud/controller/ConfigGe
tController.java
→
springcloud-service-config-
client/src/main/java/com/kwan/springcloud/controller/ConfigClien
tController.java
浏览文件 @
437f9531
...
...
@@ -5,9 +5,17 @@ import org.springframework.cloud.context.config.annotation.RefreshScope;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 需要向客户端发送post请求动态刷新才能生效
* curl -X POST "http://localhost:7002/actuator/refresh"
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/1/10 17:26
*/
@RefreshScope
@RestController
class
Config
Ge
tController
{
class
Config
Clien
tController
{
@Value
(
"${from}"
)
private
String
from
;
...
...
springcloud-service-config-client/src/main/resources/bootstrap.yml
0 → 100644
浏览文件 @
437f9531
server
:
port
:
7002
spring
:
application
:
name
:
didispace
cloud
:
config
:
label
:
master
#分支名称
profile
:
dev
#读取后缀名称
uri
:
http://localhost:7001/
#配置中心地址k
#上述3个综合:master分支上config-dev.yml的配置文件被读取
#http://localhost:7001/master/didispace-dev.yml
eureka
:
client
:
fetch-registry
:
true
register-with-eureka
:
true
service-url
:
defaultZone
:
http://eureka8767:8767/eureka/,http://eureka8768:8768/eureka/,http://eureka8769:8769/eureka/
management
:
endpoints
:
web
:
exposure
:
include
:
"
*"
springcloud-service-config-
ge
t/src/test/java/com/kwan/springcloud/PortalApplicationTests.java
→
springcloud-service-config-
clien
t/src/test/java/com/kwan/springcloud/PortalApplicationTests.java
浏览文件 @
437f9531
文件已移动
springcloud-service-config-get/src/main/resources/bootstrap.properties
已删除
100644 → 0
浏览文件 @
ffd60f0b
spring.application.name
=
didispace
spring.cloud.config.profile
=
dev
spring.cloud.config.label
=
master
spring.cloud.config.uri
=
http://localhost:7001/
server.port
=
7002
\ No newline at end of file
springcloud-service-config/pom.xml
浏览文件 @
437f9531
...
...
@@ -23,6 +23,10 @@
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-config-server
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
...
...
springcloud-service-config/src/main/java/com/kwan/springcloud/ConfigApplication.java
浏览文件 @
437f9531
...
...
@@ -3,7 +3,9 @@ package com.kwan.springcloud;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.config.server.EnableConfigServer
;
import
org.springframework.cloud.netflix.eureka.EnableEurekaClient
;
@EnableEurekaClient
@EnableConfigServer
@SpringBootApplication
public
class
ConfigApplication
{
...
...
springcloud-service-config/src/main/resources/application.yaml
浏览文件 @
437f9531
...
...
@@ -14,4 +14,10 @@ spring:
-
config-repo
username
:
13113691357
password
:
15671628341qwe
label
:
master
\ No newline at end of file
label
:
master
#服务提供者
eureka
:
client
:
service-url
:
defaultZone
:
http://eureka8767:8767/eureka/,http://eureka8768:8768/eureka/,http://eureka8769:8769/eureka/
\ No newline at end of file
springcloud-service-config/src/main/resources/bootstrap.properties
已删除
100644 → 0
浏览文件 @
ffd60f0b
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录