From 124705080bf7a5fc47791657baae4036c4685f0a Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 7 Sep 2018 14:04:23 +0100 Subject: [PATCH] Tolerate context root redirect not being configurable on Tomcat 7 Closes gh-13821 --- .../boot/autoconfigure/web/ServerProperties.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java index 6214e4f863..4046766b0e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java @@ -1049,7 +1049,12 @@ public class ServerProperties @Override public void customize(Context context) { - context.setMapperContextRootRedirectEnabled(redirectContextRoot); + try { + context.setMapperContextRootRedirectEnabled(redirectContextRoot); + } + catch (NoSuchMethodError ex) { + // Tomcat 7. Continue. + } } });