You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
527 B
Groovy
25 lines
527 B
Groovy
11 years ago
|
package org.test
|
||
|
|
||
|
@Grab("org.codehaus.groovy.modules.http-builder:http-builder:0.5.2") // This one just to test dependency resolution
|
||
|
import groovyx.net.http.*
|
||
|
|
||
|
@Controller
|
||
|
class Example implements CommandLineRunner {
|
||
|
|
||
11 years ago
|
@Autowired
|
||
|
ApplicationContext context;
|
||
|
|
||
11 years ago
|
@RequestMapping("/")
|
||
|
@ResponseBody
|
||
|
public String helloWorld() {
|
||
|
return "World!"
|
||
|
}
|
||
|
|
||
|
void run(String... args) {
|
||
8 years ago
|
def port = context.webServer.port;
|
||
11 years ago
|
def world = new RESTClient("http://localhost:" + port).get(path:"/").data.text
|
||
11 years ago
|
print "Hello " + world
|
||
|
}
|
||
10 years ago
|
|
||
11 years ago
|
}
|