Fast forward existing prototype work
This commit is contained in:
29
spring-bootstrap-cli/samples/app.groovy
Normal file
29
spring-bootstrap-cli/samples/app.groovy
Normal file
@@ -0,0 +1,29 @@
|
||||
package org.test
|
||||
|
||||
@GrabResolver(name='spring-milestone', root='http://repo.springframework.org/milestone')
|
||||
@GrabResolver(name='spring-snapshot', root='http://repo.springframework.org/snapshot')
|
||||
@Grab("org.springframework.bootstrap:spring-bootstrap:0.0.1-SNAPSHOT")
|
||||
@Grab("org.springframework:spring-context:4.0.0.BOOTSTRAP-SNAPSHOT")
|
||||
|
||||
@org.springframework.bootstrap.context.annotation.EnableAutoConfiguration
|
||||
@org.springframework.stereotype.Component
|
||||
class Example implements org.springframework.bootstrap.CommandLineRunner {
|
||||
|
||||
@org.springframework.beans.factory.annotation.Autowired
|
||||
private MyService myService;
|
||||
|
||||
public void run(String... args) {
|
||||
print "Hello " + this.myService.sayWorld();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@org.springframework.stereotype.Service
|
||||
class MyService {
|
||||
|
||||
public String sayWorld() {
|
||||
return "World!";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
24
spring-bootstrap-cli/samples/web.groovy
Normal file
24
spring-bootstrap-cli/samples/web.groovy
Normal file
@@ -0,0 +1,24 @@
|
||||
@org.springframework.bootstrap.context.annotation.EnableAutoConfiguration
|
||||
@Controller
|
||||
class Example {
|
||||
|
||||
@Autowired
|
||||
private MyService myService;
|
||||
|
||||
@RequestMapping("/")
|
||||
@ResponseBody
|
||||
public String helloWorld() {
|
||||
return myService.sayWorld();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Service
|
||||
class MyService {
|
||||
|
||||
public String sayWorld() {
|
||||
return "World!";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user