1. 新建module cloud-gateway-gateway9527
2. pom.xml
cloud2020
com.atguigu.springcloud
1.0-SNAPSHOT
4.0.0
cloud-gateway-gateway9527
org.springframework.cloud
spring-cloud-starter-gateway
org.springframework.cloud
spring-cloud-starter-netflix-eureka-client
com.atguigu.springcloud
cloud-api-commons
${project.version}
org.springframework.boot
spring-boot-devtools
runtime
true
org.projectlombok
lombok
true
org.springframework.boot
spring-boot-starter-test
test
3. application.yml
server:
port:9527spring:
application:
name: cloud-gateway
eureka:
instance:
hostname: cloud-gateway-service
client:
register-with-eureka: truefetch-registry: trueservice-url:
defaultZone: http://eureka7001.com:7001/eureka
4. 主启动类
packagecom.atguigu.springcloud;importorg.springframework.boot.SpringApplication;importorg.springframework.boot.autoconfigure.SpringBootApplication;importorg.springframework.cloud.netflix.eureka.EnableEurekaClient