1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

引入Nacos服务注册与发现

This commit is contained in:
2022-11-05 22:06:48 +08:00
parent ef6467882d
commit feeb171cff
9 changed files with 115 additions and 5 deletions

View File

@@ -31,6 +31,17 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
<!-- Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<exclusions>
<exclusion>
<artifactId>snakeyaml</artifactId>
<groupId>org.yaml</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- logback -->
<dependency>
<groupId>ch.qos.logback</groupId>

View File

@@ -2,8 +2,10 @@ package com.cxyxiaomo.epp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@EnableDiscoveryClient
public class Gateway {
public static void main(String[] args) {
SpringApplication.run(Gateway.class, args);

View File

@@ -6,6 +6,9 @@ spring:
application:
name: microservice-gateway
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
gateway:
discovery:
locator: