ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## 创建新的工程并引入依赖 ~~~ <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-zuul</artifactId> <version>2.0.1.RELEASE</version> </dependency> ~~~ 引入zuul后的依赖如下图,所以我们不必再去引入web启动器了. ![](https://box.kancloud.cn/340308770cf5bb8b51b13334b9294e9b_1330x390.png) ## 启动类 ~~~ package com.like; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.zuul.EnableZuulProxy; import org.springframework.cloud.netflix.zuul.EnableZuulServer; //@EnableZuulServer //该注解也可以使用,但是功能比较单一,推荐使用下面的EnableZuulProxy @EnableZuulProxy @SpringBootApplication public class GatewayApplication { public static void main(String[] args) { SpringApplication.run(GatewayApplication.class); } } ~~~ ## 编写配置 ~~~ server: port: 10010 spring: application: name: api-gateway ~~~