pom依赖如下,不要引入spring-boot-starter-tomcat否则会报错
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0%20https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.bins.springboot.dubbo</groupId>
<artifactId>getaway</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>getaway</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version

本文档展示了如何在Spring Boot应用中使用Spring Cloud Gateway作为API网关,并与Nacos进行整合实现服务路由。配置了POM文件避免引入spring-boot-starter-tomcat,启用了Nacos Discovery,并配置了Gateway的路由规则。启动类添加@EnableDiscoveryClient注解,使得Gateway能够发现并路由到注册在Nacos中的服务。
6097

被折叠的 条评论
为什么被折叠?



