spring cloud demo 小试牛刀

1. 先启动注册中心:

a. my-eureka工程下的MyRegistrationCenter类,run as --> java application;

b. 运行URL:http://localhost:1111/  查看是否启动成功;

成功后页面展示如下:



 

2. 启动服务

a. my-producer工程下的MyProducerStart类,run as --> java application;

b. 运行URL:http://localhost:2226/add?a=10&b=11  查看是否启动成功;



 

3. 启动含断路器的服务

a. my-consumer工程下的MyConsumerStart类,run as --> java application;

b. 运行URL:http://localhost:3337/add?a=10&b=11  查看是否启动成功;

c. 关闭my-producer工程提供的服务,二次运行URL:http://localhost:3337/add?a=10&b=11  查看是否走进断路器,正常返回-9999;


 

4. 启动网关

a. my-api-gateway工程下的MyApiGatewayStart类,run as --> java application;

b. 运行URL:http://localhost:5555/api-a/add?a=10&b=11&accessToken=110  查看是否启动成功;

5.代码见附件
 

猜你喜欢

转载自bugyun.iteye.com/blog/2350763