From 51b0451adad7cbec83a24141afef88b22d90a2cc Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 23 Apr 2014 20:10:30 +0100 Subject: [PATCH] Fix broken test due to random port change --- spring-boot-cli/samples/http.groovy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spring-boot-cli/samples/http.groovy b/spring-boot-cli/samples/http.groovy index e83ab09b924..71d771b101c 100644 --- a/spring-boot-cli/samples/http.groovy +++ b/spring-boot-cli/samples/http.groovy @@ -6,6 +6,9 @@ import groovyx.net.http.* @Controller class Example implements CommandLineRunner { + @Autowired + ApplicationContext context; + @RequestMapping("/") @ResponseBody public String helloWorld() { @@ -13,7 +16,8 @@ class Example implements CommandLineRunner { } void run(String... args) { - def world = new RESTClient("http://localhost:8080").get(path:"/").data.text + def port = context.embeddedServletContainer.port; + def world = new RESTClient("http://localhost:" + port).get(path:"/").data.text print "Hello " + world } }