From 8f5a753eff6b59270961edd109acd6cb3c19769b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Doleci=C5=84ski?= Date: Mon, 14 Sep 2015 10:26:52 +0200 Subject: [PATCH] Fix propagation of local.mongo.port up the context hierarchy Previously, a StackOverflowError would occur when using a random port for embedded mongo as the logic for propagating the property up the context hierarchy would repeatedly use the leaf context's parent. This commit updates the logic to look to see if the current context has a parent, only calling the method again if it does. Closes gh-3956 --- .../mongo/embedded/EmbeddedMongoAutoConfiguration.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java index b0916b3311..6e7cd0fba6 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java @@ -173,8 +173,8 @@ public class EmbeddedMongoAutoConfiguration { } map.put("local.mongo.port", port); } - if (this.context.getParent() != null) { - setPortProperty(this.context.getParent(), port); + if (context.getParent() != null) { + setPortProperty(context.getParent(), port); } }