SpringCloud学习笔记(十四、网关Zuul)

test

maven-clean-plugin

3.1.0

maven-resources-plugin

3.0.2

maven-compiler-plugin

3.8.0

maven-surefire-plugin

2.22.1

maven-jar-plugin

3.0.2

maven-install-plugin

2.5.2

maven-deploy-plugin

2.8.2

maven-site-plugin

3.7.1

maven-project-info-reports-plugin

3.0.0

application.yml

eureka:

client:

serviceUrl:

defaultZone: http://localhost:8761/eureka/

spring:

application:

name: product-service-zuul

zuul:

routes:

api-a:

path: /api-data/** #访问服务路径

serviceId: PRODUCT-DATA-SERVICE #服务serviceId

api-b:

path: /api-view/**

serviceId: PRODUCT-VIEW-SERVICE-FEIGN

启动类

ProductServiceZuulApplication,加了个注解@EnableZuulProxy。

package edu.hpu.springcloud;

import cn.hutool.core.util.NetUtil;

import org.springframework.boot.autoconfigure.SpringBootApplication;

import org.springframework.boot.builder.SpringApplicationBuilder;

import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

import org.springframework.cloud.netflix.zuul.EnableZuulProxy;

@SpringBootApplication

@EnableZuulProxy

@EnableEurekaClient

@EnableDiscoveryClient

public class ProductServiceZuulApplication {

public static void main(String[] args) {

int port = 8040;

if(!NetUtil.isUsableLocalPort(port)) {

System.err.printf(“端口%d被占用了,无法启动%n”, port );

System.exit(1);

}

new SpringApplicationBuilder(ProductServiceZuulApplication.class).properties(“server.port=” + port).run(args);

最后

手绘了下图所示的kafka知识大纲流程图(xmind文件不能上传,导出图片展现),但都可提供源文件给每位爱学习的朋友

image.png

r(ProductServiceZuulApplication.class).properties(“server.port=” + port).run(args);

最后

手绘了下图所示的kafka知识大纲流程图(xmind文件不能上传,导出图片展现),但都可提供源文件给每位爱学习的朋友

[外链图片转存中…(img-d2cELjaR-1714468620834)]

本文已被CODING开源项目:【一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码】收录

  • 15
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值