提交 7d27f628 编写于 作者: 武汉红喜's avatar 武汉红喜

gateway demo

上级 fa99bc04
# Spring Cloud
依次启动eureka,provider,consumer
依次启动eureka,provider,consumer,gateway
1. 直接访问 localhost:8763/hi?name=hongxi
1. 通过网关访问 localhost:8764/demo-consumer/hi?name=hongxi
1. 停掉provider,再次进行上面的访问
https://github.com/spring-cloud/spring-cloud-netflix <br>
......
......@@ -16,6 +16,10 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -2,10 +2,12 @@ package org.hongxi.whatsmars.cloud.gateway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* Created by shenhongxi on 2020/7/12.
*/
@EnableDiscoveryClient
@SpringBootApplication
public class GatewayApplication {
public static void main(String[] args) {
......
spring:
application:
name: demo-gateway
cloud:
gateway:
discovery:
locator:
enabled: true
lower-case-service-id: true
eureka:
client:
service-url:
defaultZone: http://localhost:8761/eureka/
server:
port: 8764
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册