com.nepxion.discovery.plugin.strategy.gateway.context.GatewayStrategyEnvironmentPostProcessor Maven / Gradle / Ivy
package com.nepxion.discovery.plugin.strategy.gateway.context;
/**
* Title: Nepxion Discovery
* Description: Nepxion Discovery
* Copyright: Copyright (c) 2017-2050
* Company: Nepxion
* @author Haojun Ren
* @version 1.0
*/
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.Ordered;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.StandardEnvironment;
import com.nepxion.discovery.common.constant.DiscoveryConstant;
import com.nepxion.discovery.common.entity.GatewayType;
import com.nepxion.discovery.common.entity.ServiceType;
public class GatewayStrategyEnvironmentPostProcessor implements EnvironmentPostProcessor, Ordered {
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
if (StringUtils.equals(environment.getClass().getName(), StandardEnvironment.class.getName())) {
System.setProperty(DiscoveryConstant.SPRING_APPLICATION_TYPE, ServiceType.GATEWAY.toString());
System.setProperty(DiscoveryConstant.SPRING_APPLICATION_GATEWAY_TYPE, GatewayType.SPRING_CLOUD_GATEWAY.toString());
}
}
@Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;
}
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy