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 63ebc89fc760e23d996993010127a2f5ec4a90e8..f19d814f456400a330ac96437d36bad55d6fa00f 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 63836282abc66d8bcc7f48b4877fa6befe5fe747..004c183b88847e19f22ee22682a85a5ac39e60ed 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 225f4669753db016e653cf42f7e2b8ed74d127f0..8e8955729557100c6d5a353ac2cb66a7108c0653 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