修改网关serviceId

This commit is contained in:
tanghc
2019-11-20 20:10:51 +08:00
parent 6f9fff2b89
commit 95c577f2a5
5 changed files with 5 additions and 10 deletions

View File

@@ -30,7 +30,7 @@ import java.util.stream.Stream;
public class ConfigPushService { public class ConfigPushService {
private static final String GATEWAY_PUSH_URL = "http://%s/configChannelMsg"; private static final String GATEWAY_PUSH_URL = "http://%s/configChannelMsg";
private static final String API_GATEWAY_SERVICE_ID = "api-gateway"; private static final String API_GATEWAY_SERVICE_ID = "sop-gateway";
private static HttpTool httpTool = new HttpTool(); private static HttpTool httpTool = new HttpTool();

View File

@@ -185,8 +185,8 @@ public class AbstractConfiguration implements ApplicationContextAware {
throw new IllegalArgumentException("RouteRepositoryContext.setRouteRepository()方法未使用"); throw new IllegalArgumentException("RouteRepositoryContext.setRouteRepository()方法未使用");
} }
String serverName = EnvironmentKeys.SPRING_APPLICATION_NAME.getValue(); String serverName = EnvironmentKeys.SPRING_APPLICATION_NAME.getValue();
if (!"api-gateway".equals(serverName)) { if (!"sop-gateway".equals(serverName)) {
throw new IllegalArgumentException("spring.application.name必须为api-gateway"); throw new IllegalArgumentException("spring.application.name必须为sop-gateway");
} }
String urlencode = EnvironmentKeys.SIGN_URLENCODE.getValue(); String urlencode = EnvironmentKeys.SIGN_URLENCODE.getValue();
if ("true".equals(urlencode)) { if ("true".equals(urlencode)) {

View File

@@ -22,7 +22,7 @@ public abstract class BaseRegistryListener implements RegistryListener {
public static List<String> EXCLUDE_SERVICE_ID_LIST = new ArrayList<>(8); public static List<String> EXCLUDE_SERVICE_ID_LIST = new ArrayList<>(8);
static { static {
EXCLUDE_SERVICE_ID_LIST.add("api-gateway"); EXCLUDE_SERVICE_ID_LIST.add("sop-gateway");
EXCLUDE_SERVICE_ID_LIST.add("website-server"); EXCLUDE_SERVICE_ID_LIST.add("website-server");
} }

View File

@@ -54,11 +54,6 @@
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
<!-- 使用nacos注册中心 <!-- 使用nacos注册中心
版本 0.2.x.RELEASE 对应的是 Spring Boot 2.x 版本,版本 0.1.x.RELEASE 对应的是 Spring Boot 1.x 版本。 版本 0.2.x.RELEASE 对应的是 Spring Boot 2.x 版本,版本 0.1.x.RELEASE 对应的是 Spring Boot 1.x 版本。
https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-alibaba-nacos-discovery https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-alibaba-nacos-discovery

View File

@@ -1,6 +1,6 @@
server.port=8081 server.port=8081
# 固定不变 # 固定不变
spring.application.name=api-gateway spring.application.name=sop-gateway
# ------- 需要改的配置 ------- # ------- 需要改的配置 -------
# mysql数据库账号 # mysql数据库账号