From f8b735be71d2b073f7b91522ab2cc3a048e18e77 Mon Sep 17 00:00:00 2001 From: qinyingjie Date: Tue, 17 Jan 2023 12:59:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E9=85=8D=E7=BD=AEnacos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/kwan/springcloudalibaba/NacosApplication.java | 8 ++++++++ .../springcloudalibaba/controller/NacosController.java | 3 +++ .../src/main/resources/{application.yml => bootstrap.yml} | 7 ++++--- 3 files changed, 15 insertions(+), 3 deletions(-) rename springcloudalibaba-server-nacos-producer/src/main/resources/{application.yml => bootstrap.yml} (70%) diff --git a/springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/NacosApplication.java b/springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/NacosApplication.java index 63ebc89..f19d814 100644 --- a/springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/NacosApplication.java +++ b/springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/NacosApplication.java @@ -3,6 +3,14 @@ package com.kwan.springcloudalibaba; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * http://localhost:18082/nacos/nameInfo + * + * @author : qinyingjie + * @version : 2.2.0 + * @date : 2023/1/17 12:37 + */ @SpringBootApplication public class NacosApplication { diff --git a/springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/controller/NacosController.java b/springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/controller/NacosController.java index 6383628..004c183 100644 --- a/springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/controller/NacosController.java +++ b/springcloudalibaba-server-nacos-producer/src/main/java/com/kwan/springcloudalibaba/controller/NacosController.java @@ -2,11 +2,14 @@ package com.kwan.springcloudalibaba.controller; import com.kwan.springcloudalibaba.common.Result; import org.springframework.beans.factory.annotation.Value; +import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + +@RefreshScope @RestController @RequestMapping("/nacos") public class NacosController { diff --git a/springcloudalibaba-server-nacos-producer/src/main/resources/application.yml b/springcloudalibaba-server-nacos-producer/src/main/resources/bootstrap.yml similarity index 70% rename from springcloudalibaba-server-nacos-producer/src/main/resources/application.yml rename to springcloudalibaba-server-nacos-producer/src/main/resources/bootstrap.yml index 225f466..8e89557 100644 --- a/springcloudalibaba-server-nacos-producer/src/main/resources/application.yml +++ b/springcloudalibaba-server-nacos-producer/src/main/resources/bootstrap.yml @@ -21,6 +21,7 @@ spring: cloud: nacos: discovery: - server-addr: 192.168.172.128:8848 - password: nacos - username: nacos + server-addr: http://120.79.36.53:8848 + config: + server-addr: http://120.79.36.53:8848 + file-extension: yaml \ No newline at end of file -- GitLab