From 4d60b09c9bd5111c6009f7e552745f16e7687bb0 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Fri, 27 Dec 2013 11:19:52 +0000 Subject: [PATCH] Revise docs for port discovery --- docs/howto.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/howto.md b/docs/howto.md index a34ca53062..a588335fe3 100644 --- a/docs/howto.md +++ b/docs/howto.md @@ -440,8 +440,10 @@ To scan for a free port (using OS natives to prevent clashes) use You can access the port the server is running on from log output or from the `EmbeddedWebApplicationContext` via its -`EmbeddedServletContainer` (you can `@Autowired` an -`ApplicationContext` and downcast it to obtain the specific type). +`EmbeddedServletContainer`. The best way to get that and be sure that +it has initialized is to add a `@Bean` of type +`ApplicationListener` and +pull the container out of the event wehen it is published. ## Change the HTTP Port or Address of the Actuator Endpoints