From 7f0791a79af0cfc8faef044c98f52fa44800b3d9 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Thu, 11 Jan 2018 15:05:01 -0500 Subject: [PATCH] Force bootstrap env to set web-application-type=none Ff an app (or test) uses spring.main.web-application-type=reactive, bootstrap will fail. This commit forces the environment to use none, because the environment overrides the setter on SpringApplication. --- .../cloud/bootstrap/BootstrapApplicationListener.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/BootstrapApplicationListener.java b/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/BootstrapApplicationListener.java index c292ffa8..864733d8 100644 --- a/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/BootstrapApplicationListener.java +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/BootstrapApplicationListener.java @@ -143,6 +143,10 @@ public class BootstrapApplicationListener .resolvePlaceholders("${spring.cloud.bootstrap.location:}"); Map bootstrapMap = new HashMap<>(); bootstrapMap.put("spring.config.name", configName); + // if an app (or test) uses spring.main.web-application-type=reactive, bootstrap will fail + // force the environment to use none, because if though it is set below in the builder + // the environment overrides it + bootstrapMap.put("spring.main.web-application-type", "none"); if (StringUtils.hasText(configLocation)) { bootstrapMap.put("spring.config.location", configLocation); }