Further maven module restructure

This commit is contained in:
Phillip Webb
2013-07-08 11:41:51 -07:00
parent 9fde0a3715
commit cd51f357a3
420 changed files with 92 additions and 92 deletions

View File

@@ -0,0 +1,15 @@
package org.test
@Grab("org.springframework.zero:spring-zero-actuator:0.5.0.BUILD-SNAPSHOT")
@Controller
class SampleController {
@RequestMapping("/")
@ResponseBody
public def hello() {
[message: "Hello World!"]
}
}

View File

@@ -0,0 +1,23 @@
package org.test
@Component
class Example implements CommandLineRunner {
@Autowired
private MyService myService
void run(String... args) {
print "Hello " + this.myService.sayWorld()
}
}
@Service
class MyService {
String sayWorld() {
return "World!"
}
}

View File

@@ -0,0 +1,17 @@
package org.test
@Component
@EnableIntegrationPatterns
class SpringIntegrationExample implements CommandLineRunner {
@Bean
MessageFlow flow(ApplicationContext context) {
def builder = new IntegrationBuilder(context)
builder.messageFlow { transform {"Hello, $it!"} }
}
@Override
void run(String... args) {
print flow().sendAndReceive("World")
}
}

View File

@@ -0,0 +1,35 @@
package org.test
@Grab("org.hsqldb:hsqldb-j5:2.0.0")
@Configuration
@EnableBatchProcessing
class JobConfig {
@Autowired
private JobBuilderFactory jobs
@Autowired
private StepBuilderFactory steps
@Bean
protected Tasklet tasklet() {
return new Tasklet() {
@Override
RepeatStatus execute(StepContribution contribution, ChunkContext context) {
return RepeatStatus.FINISHED
}
}
}
@Bean
Job job() throws Exception {
return jobs.get("job").start(step1()).build()
}
@Bean
protected Step step1() throws Exception {
return steps.get("step1").tasklet(tasklet()).build()
}
}

View File

@@ -0,0 +1,10 @@
package org.test
class Runner implements CommandLineRunner {
void run(String... args) {
print "Hello World!"
}
}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="runner" class="org.test.Runner"/>
</beans>

View File

@@ -0,0 +1,25 @@
package org.test
import static org.springframework.zero.cli.template.GroovyTemplate.template;
@Component
class Example implements CommandLineRunner {
@Autowired
private MyService myService
void run(String... args) {
print template("test.txt", ["message":myService.sayWorld()])
}
}
@Service
class MyService {
String sayWorld() {
return "World"
}
}

View File

@@ -0,0 +1,11 @@
@Grab("org.thymeleaf:thymeleaf-spring3:2.0.16")
@Controller
class Example {
@RequestMapping("/")
public String helloWorld(Map<String,Object> model) {
model.putAll([title: "My Page", date: new Date(), message: "Hello World"])
return "home";
}
}

View File

@@ -0,0 +1,23 @@
@Controller
class Example {
@Autowired
private MyService myService;
@RequestMapping("/")
@ResponseBody
public String helloWorld() {
return myService.sayWorld();
}
}
@Service
class MyService {
public String sayWorld() {
return "World!";
}
}