polish
This commit is contained in:
@@ -1,30 +1,21 @@
|
||||
package org.springframework.cloud.gateway.config;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
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.MapPropertySource;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
*/
|
||||
public class GatewayEnvironmentPostProcessor implements EnvironmentPostProcessor, Ordered {
|
||||
|
||||
private static final Map<String, Object> PROPERTIES;
|
||||
|
||||
public static final int DEFAULT_ORDER = Ordered.HIGHEST_PRECEDENCE + 10;
|
||||
|
||||
static {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("spring.resources.add-mappings", "false");
|
||||
PROPERTIES = Collections.unmodifiableMap(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return DEFAULT_ORDER;
|
||||
@@ -34,7 +25,8 @@ public class GatewayEnvironmentPostProcessor implements EnvironmentPostProcessor
|
||||
public void postProcessEnvironment(ConfigurableEnvironment configurableEnvironment, SpringApplication springApplication) {
|
||||
//TODO: make this configurable?
|
||||
//TODO: should I have to do this?
|
||||
configurableEnvironment.getPropertySources().addLast(new MapPropertySource("gateway", PROPERTIES));
|
||||
final Map<String, Object> properties = Collections.singletonMap("spring.resources.add-mappings", "false");
|
||||
configurableEnvironment.getPropertySources().addLast(new MapPropertySource("gateway", properties));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user