SpringCloud-Gateway configures nacos to implement lb dynamic routing and cannot be mapped to the corresponding service address

When configuring routing through the gateway, the uri parameter cannot be mapped to the corresponding service address using lb://service-hosp, but it can be mapped successfully when using the original service address http://localhost:8201

The uri parameter uses the original service address http://localhost:8201

 The uri parameter uses lb://service-hosp 

 After tinkering for a long time, I opened the pom.xml  file unexpectedly during dinner  : I don’t know when this dependency was annotated . The gateway and nacos need to introduce the spring-cloud-starter-loadbalancer dependency. Remove the annotation and re-import the dependency. normal access

 <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>

 

Guess you like

Origin blog.csdn.net/m0_62639693/article/details/127374245