专注于 JetBrains IDEA 全家桶,永久激活,教程
持续更新 PyCharm,IDEA,WebStorm,PhpStorm,DataGrip,RubyMine,CLion,AppCode 永久激活教程

spring cloud zuul的基本配置

环境搭建

1、创建工程zuul-server

2、引入pom文件:


<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-zuul</artifactId> </dependency> 3. 创建启动类并开启zuul网关 @SpringBootApplication @EnableZuulProxy //开启zuul网关 public class ZuulApplication { public static void main(String[] args) { SpringApplication.run(ZuulApplication.class, args); } }

4、创建配置文件


\#端口 server: port: 8080 #服务名称 spring: application: name: zuul-service

路由配置

1、基础路由配置


zuul: routes: product-service: product-service #如果路由id和对应的服务serviceId一致的话

2、添加eureka依赖


<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency>

3、配置启动类添加eureka服务发现功能

110_1.png

4、在zuul网关服务中添加eureka相关配置


\#配置Eureka eureka: client: service-url: defaultZone: http://localhost:9000/eureka/ instance: prefer-ip-address: true #使用ip地址注册
未经允许不得转载:搜云库技术团队 » spring cloud zuul的基本配置

JetBrains 全家桶,激活、破解、教程

提供 JetBrains 全家桶激活码、注册码、破解补丁下载及详细激活教程,支持 IntelliJ IDEA、PyCharm、WebStorm 等工具的永久激活。无论是破解教程,还是最新激活码,均可免费获得,帮助开发者解决常见激活问题,确保轻松破解并快速使用 JetBrains 软件。获取免费的破解补丁和激活码,快速解决激活难题,全面覆盖 2024/2025 版本!

联系我们联系我们