diff --git a/core/spring-boot/src/main/java/org/springframework/boot/cloud/CloudPlatform.java b/core/spring-boot/src/main/java/org/springframework/boot/cloud/CloudPlatform.java index 5cc8a07e035..54c26ff7f4d 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/cloud/CloudPlatform.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/cloud/CloudPlatform.java @@ -49,6 +49,10 @@ public enum CloudPlatform { return false; } + @Override + public boolean isUsingForwardHeaders() { + return false; + } }, /** diff --git a/core/spring-boot/src/test/java/org/springframework/boot/cloud/CloudPlatformTests.java b/core/spring-boot/src/test/java/org/springframework/boot/cloud/CloudPlatformTests.java index 9223f513971..4c5d92dd7e9 100644 --- a/core/spring-boot/src/test/java/org/springframework/boot/cloud/CloudPlatformTests.java +++ b/core/spring-boot/src/test/java/org/springframework/boot/cloud/CloudPlatformTests.java @@ -271,6 +271,7 @@ class CloudPlatformTests { assertThat(CloudPlatform.KUBERNETES.isEnforced(binder)).isFalse(); } + @Test void isActiveWhenNoCloudPlatformIsEnforcedAndHasKubernetesServiceHostAndKubernetesServicePort() { Map envVars = new HashMap<>(); envVars.put("EXAMPLE_SERVICE_HOST", "---"); @@ -281,6 +282,11 @@ class CloudPlatformTests { .containsExactly(CloudPlatform.NONE); } + @Test + void nonePlatformShouldDisableCloudPlatformFeatures() { + assertThat(CloudPlatform.NONE.isUsingForwardHeaders()).isFalse(); + } + private Environment getEnvironmentWithEnvVariables(Map environmentVariables) { MockEnvironment environment = new MockEnvironment(); PropertySource propertySource = new SystemEnvironmentPropertySource(