From 50f37bf670ba3896748ca6556de9f09935e5fed6 Mon Sep 17 00:00:00 2001 From: YuLuo <1481556636@qq.com> Date: Sat, 15 Jul 2023 14:26:12 +0800 Subject: [PATCH] fix nacos-reactive-discovery-example run failed (#3376) --- .../alibaba/cloud/examples/ConsumerReactiveApplication.java | 6 ++++++ .../com/alibaba/cloud/examples/WebClientConfiguration.java | 3 +++ 2 files changed, 9 insertions(+) diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/java/com/alibaba/cloud/examples/ConsumerReactiveApplication.java b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/java/com/alibaba/cloud/examples/ConsumerReactiveApplication.java index 94a5df8cb..c6abf0551 100644 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/java/com/alibaba/cloud/examples/ConsumerReactiveApplication.java +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/java/com/alibaba/cloud/examples/ConsumerReactiveApplication.java @@ -18,11 +18,17 @@ package com.alibaba.cloud.examples; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient; +import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients; /** * @author Jim */ + @SpringBootApplication +@LoadBalancerClients({ + @LoadBalancerClient("service-provider") +}) public class ConsumerReactiveApplication { public static void main(String[] args) { diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/java/com/alibaba/cloud/examples/WebClientConfiguration.java b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/java/com/alibaba/cloud/examples/WebClientConfiguration.java index 61a93aa25..9282049c3 100644 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/java/com/alibaba/cloud/examples/WebClientConfiguration.java +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/java/com/alibaba/cloud/examples/WebClientConfiguration.java @@ -18,6 +18,7 @@ package com.alibaba.cloud.examples; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; import org.springframework.web.reactive.function.client.WebClient; /** @@ -25,6 +26,8 @@ import org.springframework.web.reactive.function.client.WebClient; * * @author fangjian0423, MieAh */ + +@Configuration public class WebClientConfiguration { @Bean