Skip to content

Commit 9b06ebd

Browse files
committed
Drop in code from manuscript
1 parent 67820a9 commit 9b06ebd

File tree

325 files changed

+13133
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+13133
-0
lines changed

ch1/.bowerrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "public/"
3+
}

ch1/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public

ch1/app.groovy

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@RestController
2+
class App {
3+
@RequestMapping("/")
4+
def home() {
5+
"Hello, world!"
6+
}
7+
}

ch1/app_with_grab.groovy

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//@Grab("spring-boot-starter-web")
2+
//@Grab("groovy-templates")
3+
4+
@RestController
5+
class App {
6+
@RequestMapping("/")
7+
def home() {
8+
"Hello, world!"
9+
}
10+
}

ch1/app_with_grab_and_import.groovy

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//@Grab("spring-boot-starter-web")
2+
//@Grab("groovy-templates")
3+
4+
//import org.springframework.web.bind.annotation.*
5+
//import org.springframework.web.servlet.config.annotation.*
6+
//import org.springframework.web.servlet.*
7+
//import org.springframework.web.servlet.handler.*
8+
//import org.springframework.http.*
9+
//import org.springframework.ui.*
10+
11+
//static import org.springframework.boot.cli.template.GroovyTemplate.template
12+
13+
@RestController
14+
class App {
15+
@RequestMapping("/")
16+
def home() {
17+
"Hello, world!"
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//@Grab("spring-boot-starter-web")
2+
//@Grab("groovy-templates")
3+
4+
//import org.springframework.web.bind.annotation.*
5+
//import org.springframework.web.servlet.config.annotation.*
6+
//import org.springframework.web.servlet.*
7+
//import org.springframework.web.servlet.handler.*
8+
//import org.springframework.http.*
9+
//import org.springframework.ui.*
10+
11+
//static import org.springframework.boot.cli.template.GroovyTemplate.template
12+
13+
//@EnableAutoConfiguration
14+
@RestController
15+
class App {
16+
@RequestMapping("/")
17+
def home() {
18+
"Hello, world!"
19+
}
20+
21+
//static void main(String[] args) {
22+
// SpringApplication.run(App.class, args)
23+
//}
24+
}

ch1/app_with_views.groovy

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@Grab("thymeleaf-spring4")
2+
@Controller
3+
class ViewBasedApp {
4+
5+
def chapters = ["Quick Start With Groovy",
6+
"Quick Start With Java",
7+
"Debugging and Managing Your App",
8+
"Data Access with Spring Boot",
9+
"Securing Your App"]
10+
11+
@RequestMapping("/")
12+
def home(@RequestParam(value="name", defaultValue="World") String n) {
13+
new ModelAndView("home")
14+
.addObject("name", n)
15+
.addObject("chapters", chapters)
16+
}
17+
}

ch1/book_and_tests.groovy

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Book {
2+
String author
3+
String title
4+
}
5+
6+
class BookTests {
7+
@Test
8+
void testBooks() {
9+
Book book = new Book(author: "Tom Clancy",
10+
title: "Threat Vector")
11+
assertEquals("Tom Clancy", book.author)
12+
}
13+
}

ch1/bower.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "app_with_bower",
3+
"version": "0.1.0",
4+
"authors": [
5+
"Greg Turnquist <gturnquist@pivotal.io>"
6+
],
7+
"description": "Learning Spring Boot - bower sample",
8+
"license": "ASL",
9+
"homepage": "http://blog.greglturnquist.com/category/learning-spring-boot",
10+
"private": true,
11+
"ignore": [
12+
"**/.*",
13+
"node_modules",
14+
"bower_components",
15+
"public/",
16+
"test",
17+
"tests"
18+
],
19+
"dependencies": {
20+
"jquery": "~2.1.1"
21+
}
22+
}

ch1/modern.groovy

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@Grab("org.webjars:jquery:2.1.1")
2+
@Grab("thymeleaf-spring4")
3+
@Controller
4+
class ModernApp {
5+
6+
def chapters = ["Quick Start With Groovy",
7+
"Quick Start With Java",
8+
"Debugging and Managing Your App",
9+
"Data Access with Spring Boot",
10+
"Securing Your App"]
11+
12+
@RequestMapping("/")
13+
def home(@RequestParam(value="name", defaultValue="World") String n) {
14+
new ModelAndView("modern")
15+
.addObject("name", n)
16+
.addObject("chapters", chapters)
17+
}
18+
}

ch1/modern_with_bower.groovy

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@Grab("thymeleaf-spring4")
2+
@Controller
3+
class ModernApp {
4+
5+
def chapters = ["Quick Start With Groovy",
6+
"Quick Start With Java",
7+
"Debugging and Managing Your App",
8+
"Data Access with Spring Boot",
9+
"Securing Your App"]
10+
11+
@RequestMapping("/")
12+
def home(@RequestParam(value="name", defaultValue="World") String n) {
13+
new ModelAndView("modern_with_bower")
14+
.addObject("name", n)
15+
.addObject("chapters", chapters)
16+
}
17+
}

ch1/ops.groovy

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@Grab("spring-boot-actuator")
2+
@Grab("spring-boot-starter-remote-shell")
3+
@Grab("org.webjars:jquery:2.1.1")
4+
@Grab("thymeleaf-spring4")
5+
@Controller
6+
class OpsReadyApp {
7+
@RequestMapping("/")
8+
def home(@RequestParam(value="name", defaultValue="World") String n) {
9+
new ModelAndView("modern")
10+
.addObject("name", n)
11+
}
12+
}

ch1/pure_javascript.groovy

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@Controller
2+
class JsApp { }

ch1/spock.groovy

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class HelloSpock extends Specification {
2+
def "length of Spock's and his friends' names"() {
3+
expect:
4+
name.size() == length
5+
6+
where:
7+
name | length
8+
"Spock" | 5
9+
"Kirk" | 4
10+
"Scotty" | 6
11+
}
12+
}

ch1/static/index.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<html>
2+
Greetings from pure HTML which can, in turn, load JavaScript!
3+
</html>

ch1/templates/home.html

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<html>
2+
<head>
3+
<title>Learning Spring Boot - Chapter 1</title>
4+
</head>
5+
<body>
6+
<p th:text="'Hello, ' + ${name}"></p>
7+
<ol>
8+
<li th:each="chapter : ${chapters}" th:text="${chapter}"></li>
9+
</ol>
10+
</body>
11+
</html>

ch1/templates/modern.html

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<html>
2+
<head>
3+
<title>Learning Spring Boot - Chapter 1</title>
4+
<script src="webjars/jquery/2.1.1/jquery.min.js"></script>
5+
<script>
6+
$(document).ready(function() {
7+
$('p').animate({
8+
fontSize: '48px',
9+
}, "slow");
10+
});
11+
</script>
12+
</head>
13+
<body>
14+
<p th:text="'Hello, ' + ${name}"></p>
15+
<ol>
16+
<li th:each="chapter : ${chapters}" th:text="${chapter}"></li>
17+
</ol>
18+
</body>
19+
</html>

ch1/templates/modern_with_bower.html

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<html>
2+
<head>
3+
<title>Learning Spring Boot - Chapter 1</title>
4+
<script src="jquery/dist/jquery.min.js"></script>
5+
<script>
6+
$(document).ready(function() {
7+
$('p').animate({
8+
fontSize: '48px',
9+
}, "slow");
10+
});
11+
</script>
12+
</head>
13+
<body>
14+
<p th:text="'Hello, ' + ${name}"></p>
15+
<ol>
16+
<li th:each="chapter : ${chapters}" th:text="${chapter}"></li>
17+
</ol>
18+
</body>
19+
</html>

ch2/issue-manager-1/build.gradle

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// tag::plugins[]
2+
buildscript {
3+
repositories {
4+
mavenCentral()
5+
}
6+
dependencies {
7+
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.6.RELEASE")
8+
}
9+
}
10+
// end::plugins[]
11+
12+
apply plugin: 'java'
13+
apply plugin: 'eclipse'
14+
apply plugin: 'idea'
15+
apply plugin: 'spring-boot'
16+
17+
jar {
18+
baseName = 'issue-manager'
19+
version = '0.0.1-SNAPSHOT'
20+
}
21+
22+
// tag::version[]
23+
sourceCompatibility = 1.8
24+
targetCompatibility = 1.8
25+
// end::version[]
26+
27+
repositories {
28+
mavenCentral()
29+
}
30+
31+
32+
// tag::dependencies[]
33+
dependencies {
34+
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
35+
testCompile("org.springframework.boot:spring-boot-starter-test")
36+
}
37+
// end::dependencies[]
38+
39+
task wrapper(type: Wrapper) {
40+
gradleVersion = '2.1'
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Mon Sep 15 19:52:02 CDT 2014
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-bin.zip

0 commit comments

Comments
 (0)