diff --git a/spring-boot-cli/samples/actuator.groovy b/spring-boot-cli/samples/actuator.groovy index 21e4df8f9a..ffad280f9d 100644 --- a/spring-boot-cli/samples/actuator.groovy +++ b/spring-boot-cli/samples/actuator.groovy @@ -2,14 +2,11 @@ package org.test @Grab("spring-boot-starter-actuator") -@Controller +@RestController class SampleController { @RequestMapping("/") - @ResponseBody public def hello() { [message: "Hello World!"] } } - - diff --git a/spring-boot-cli/samples/secure.groovy b/spring-boot-cli/samples/secure.groovy new file mode 100644 index 0000000000..6615bc144f --- /dev/null +++ b/spring-boot-cli/samples/secure.groovy @@ -0,0 +1,13 @@ +package org.test + +@Grab("spring-boot-starter-security") +@Grab("spring-boot-starter-actuator") + +@RestController +class SampleController { + + @RequestMapping("/") + public def hello() { + [message: "Hello World!"] + } +} diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/ReproIntegrationTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/ReproIntegrationTests.java index 51644f3362..223833d2c7 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/ReproIntegrationTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/ReproIntegrationTests.java @@ -39,4 +39,20 @@ public class ReproIntegrationTests { containsString("{\"message\":\"Hello World\"}")); } + // Security depends on old versions of Spring so if the dependencies aren't pinned + // this will fail + @Test + public void securityDependencies() throws Exception { + this.cli.run("secure.groovy"); + assertThat(this.cli.getHttpOutput(), + containsString("{\"message\":\"Hello World\"}")); + } + + @Test + public void shellDependencies() throws Exception { + this.cli.run("crsh.groovy"); + assertThat(this.cli.getHttpOutput(), + containsString("{\"message\":\"Hello World\"}")); + } + } diff --git a/spring-boot-cli/src/test/resources/repro-samples/crsh.groovy b/spring-boot-cli/src/test/resources/repro-samples/crsh.groovy new file mode 100644 index 0000000000..9d827ad1b7 --- /dev/null +++ b/spring-boot-cli/src/test/resources/repro-samples/crsh.groovy @@ -0,0 +1,14 @@ +package org.test + +@Grab("spring-boot-starter-shell-remote") + +@RestController +class SampleController { + + @RequestMapping("/") + public def hello() { + [message: "Hello World!"] + } +} + + diff --git a/spring-boot-cli/src/test/resources/repro-samples/secure.groovy b/spring-boot-cli/src/test/resources/repro-samples/secure.groovy new file mode 100644 index 0000000000..a03471d452 --- /dev/null +++ b/spring-boot-cli/src/test/resources/repro-samples/secure.groovy @@ -0,0 +1,15 @@ +package org.test + +// No security features added just a test that the dependencies are resolved +@Grab("spring-boot-starter-security") + +@RestController +class SampleController { + + @RequestMapping("/") + public def hello() { + [message: "Hello World!"] + } +} + +