SpringCloud Eureka Client SpringCloud添加客户端Eureka Client过程解析
玉天恒 人气:01.添加依赖
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency>
2.添加客户端配置
/src/main/java/resource/application.yml
server: port: 8770 eureka: client: serviceUrl: defaultZone: http://localhost:8761/eureka/ spring: application: name: shop-gateway
3.添加启动类注解
@SpringBootApplication @EnableDiscoveryClient public class ShopGatewayApplication { public static void main(String[] args) { SpringApplication.run(ShopGatewayApplication.class, args); } }
4.启动注册中心后,再启动客户端
访问地址
http://localhost:8761
如图:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
加载全部内容