Use simplified @Grab where possible
This commit is contained in:
parent
1dd0cca294
commit
3adfdd34ec
|
@ -1,6 +1,6 @@
|
||||||
package org.test
|
package org.test
|
||||||
|
|
||||||
@Grab("org.springframework.boot:spring-boot-starter-actuator:0.5.0.BUILD-SNAPSHOT")
|
@Grab("spring-boot-starter-actuator")
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
class SampleController {
|
class SampleController {
|
||||||
|
|
|
@ -6,15 +6,15 @@ class Example {
|
||||||
|
|
||||||
@RequestMapping("/")
|
@RequestMapping("/")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String helloWorld(Device device) {
|
String helloWorld(Device device) {
|
||||||
if (device.isNormal()) {
|
if (device.isNormal()) {
|
||||||
return "Hello Normal Device!"
|
"Hello Normal Device!"
|
||||||
} else if (device.isMobile()) {
|
} else if (device.isMobile()) {
|
||||||
return "Hello Mobile Device!"
|
"Hello Mobile Device!"
|
||||||
} else if (device.isTablet()) {
|
} else if (device.isTablet()) {
|
||||||
return "Hello Tablet Device!"
|
"Hello Tablet Device!"
|
||||||
} else {
|
} else {
|
||||||
return "Hello Unknown Device!"
|
"Hello Unknown Device!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.test
|
package org.test
|
||||||
|
|
||||||
@Grab("org.hsqldb:hsqldb-j5:2.0.0")
|
@Grab("hsqldb")
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableBatchProcessing
|
@EnableBatchProcessing
|
||||||
class JobConfig {
|
class JobConfig {
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
package org.test
|
|
||||||
|
|
||||||
@Grab('spring-boot-starter-web')
|
|
||||||
@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!"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.test
|
package org.test
|
||||||
|
|
||||||
@Grab("org.hsqldb:hsqldb:2.2.9")
|
@Grab("hsqldb")
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package app
|
package app
|
||||||
|
|
||||||
import groovy.util.logging.Log
|
@Grab("thymeleaf-spring3")
|
||||||
|
|
||||||
@Grab("org.thymeleaf:thymeleaf-spring3:2.0.16")
|
|
||||||
@Controller
|
@Controller
|
||||||
class Example {
|
class Example {
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,6 @@
|
||||||
|
|
||||||
package org.springframework.boot.cli;
|
package org.springframework.boot.cli;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
@ -37,6 +34,9 @@ import org.springframework.boot.OutputCapture;
|
||||||
import org.springframework.boot.cli.command.CleanCommand;
|
import org.springframework.boot.cli.command.CleanCommand;
|
||||||
import org.springframework.boot.cli.command.RunCommand;
|
import org.springframework.boot.cli.command.RunCommand;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integration tests to exercise the samples.
|
* Integration tests to exercise the samples.
|
||||||
*
|
*
|
||||||
|
@ -95,13 +95,6 @@ public class SampleIntegrationTests {
|
||||||
assertTrue("Wrong output: " + output, output.contains("Hello World"));
|
assertTrue("Wrong output: " + output, output.contains("Hello World"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void simpleGrabSample() throws Exception {
|
|
||||||
start("samples/simpleGrab.groovy");
|
|
||||||
String output = this.outputCapture.getOutputAndRelease();
|
|
||||||
assertTrue("Wrong output: " + output, output.contains("Hello World"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void templateSample() throws Exception {
|
public void templateSample() throws Exception {
|
||||||
start("samples/template.groovy");
|
start("samples/template.groovy");
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<slf4j.version>1.7.5</slf4j.version>
|
<slf4j.version>1.7.5</slf4j.version>
|
||||||
<snakeyaml.version>1.12</snakeyaml.version>
|
<snakeyaml.version>1.12</snakeyaml.version>
|
||||||
<spock.version>0.7-groovy-2.0</spock.version>
|
<spock.version>0.7-groovy-2.0</spock.version>
|
||||||
<spring.version>4.0.0.M3</spring.version>
|
<spring.version>4.0.0.BUILD-SNAPSHOT</spring.version>
|
||||||
<spring-security.version>3.2.0.RC1</spring-security.version>
|
<spring-security.version>3.2.0.RC1</spring-security.version>
|
||||||
<spring-integration.version>2.2.4.RELEASE</spring-integration.version>
|
<spring-integration.version>2.2.4.RELEASE</spring-integration.version>
|
||||||
<spring-integration-groovydsl.version>1.0.0.M1</spring-integration-groovydsl.version>
|
<spring-integration-groovydsl.version>1.0.0.M1</spring-integration-groovydsl.version>
|
||||||
|
|
Loading…
Reference in New Issue