We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4119ef5 commit 51b0451Copy full SHA for 51b0451
spring-boot-cli/samples/http.groovy
@@ -6,14 +6,18 @@ import groovyx.net.http.*
6
@Controller
7
class Example implements CommandLineRunner {
8
9
+ @Autowired
10
+ ApplicationContext context;
11
+
12
@RequestMapping("/")
13
@ResponseBody
14
public String helloWorld() {
15
return "World!"
16
}
17
18
void run(String... args) {
- def world = new RESTClient("http://localhost:8080").get(path:"/").data.text
19
+ def port = context.embeddedServletContainer.port;
20
+ def world = new RESTClient("http://localhost:" + port).get(path:"/").data.text
21
print "Hello " + world
22
23
0 commit comments