修改网关serviceId

pull/1/head
tanghc 5 years ago
parent 6f9fff2b89
commit 95c577f2a5
  1. 2
      sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/ConfigPushService.java
  2. 4
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/manager/AbstractConfiguration.java
  3. 2
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/route/BaseRegistryListener.java
  4. 5
      sop-gateway/pom.xml
  5. 2
      sop-gateway/src/main/resources/application-dev.properties

@ -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();

@ -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)) {

@ -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");
} }

@ -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

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

Loading…
Cancel
Save