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
This commit is contained in:
Paweł Doleciński 2015-09-14 10:26:52 +02:00 committed by Andy Wilkinson
parent b79ca614a1
commit 8f5a753eff
1 changed files with 2 additions and 2 deletions

View File

@ -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);
}
}