Skip to content

Commit 4151c02

Browse files
committed
Chapter 1 final edits, and Docker in chapter 5
1 parent cac7e07 commit 4151c02

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

1-reactive/src/test/java/com/greglturnquist/hackingspringboot/reactive/DishMetaphor.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class KitchenService {
2929
Flux<Dish> getDishes() {
3030
// You could model a ChefService, but let's just
3131
// hard code some tasty dishes.
32-
return Flux.just( //
33-
new Dish("Sesame chicken"), //
34-
new Dish("Lo mein noodles, plain"), //
32+
return Flux.just(
33+
new Dish("Sesame chicken"),
34+
new Dish("Lo mein noodles, plain"),
3535
new Dish("Sweet & sour beef"));
3636
}
3737
}
@@ -47,7 +47,7 @@ class SimpleServer {
4747
}
4848

4949
Flux<Dish> doingMyJob() {
50-
return this.kitchen.getDishes() //
50+
return this.kitchen.getDishes()
5151
.map(dish -> this.deliver(dish));
5252
}
5353

@@ -69,10 +69,10 @@ class PoliteServer {
6969
}
7070

7171
Flux<Dish> doingMyJob() {
72-
return this.kitchen.getDishes() //
73-
.doOnNext(dish -> System.out.println("Thank you for " + dish + "!")) //
74-
.doOnError(error -> System.out.println("So sorry about " + error.getMessage())) //
75-
.doOnComplete(() -> System.out.println("Thanks for all your hard work!")) //
72+
return this.kitchen.getDishes()
73+
.doOnNext(dish -> System.out.println("Thank you for " + dish + "!"))
74+
.doOnError(error -> System.out.println("So sorry about " + error.getMessage()))
75+
.doOnComplete(() -> System.out.println("Thanks for all your hard work!"))
7676
.map(this::deliver);
7777
}
7878

@@ -93,12 +93,12 @@ class BusyServer {
9393

9494
Flux<Dish> doingMyJob() {
9595
// tag::multiple-side-effects[]
96-
return this.kitchen.getDishes() //
97-
.doOnNext(dish -> { //
98-
System.out.println("Thank you for " + dish + "!"); //
99-
System.out.println("Marking the ticket as done."); //
100-
System.out.println("Grabbing some silverware."); //
101-
}) //
96+
return this.kitchen.getDishes()
97+
.doOnNext(dish -> {
98+
System.out.println("Thank you for " + dish + "!");
99+
System.out.println("Marking the ticket as done.");
100+
System.out.println("Grabbing some silverware.");
101+
})
102102
.map(this::deliver);
103103
// end::multiple-side-effects[]
104104
}
@@ -119,10 +119,10 @@ class BusyServer2 {
119119

120120
Flux<Dish> doingMyJob() {
121121
// tag::multiple-side-effects2[]
122-
return this.kitchen.getDishes() //
123-
.doOnNext(dish -> System.out.println("Thank you for " + dish + "!")) //
124-
.doOnNext(dish -> System.out.println("Marking the ticket as done.")) //
125-
.doOnNext(dish -> System.out.println("Grabbing some silverware.")) //
122+
return this.kitchen.getDishes()
123+
.doOnNext(dish -> System.out.println("Thank you for " + dish + "!"))
124+
.doOnNext(dish -> System.out.println("Marking the ticket as done."))
125+
.doOnNext(dish -> System.out.println("Grabbing some silverware."))
126126
.map(this::deliver);
127127
// end::multiple-side-effects2[]
128128
}
@@ -153,9 +153,9 @@ public void setDelivered(boolean delivered) {
153153

154154
@Override
155155
public String toString() {
156-
return "Dish{" + //
157-
"description='" + description + '\'' + //
158-
", delivered=" + delivered + //
156+
return "Dish{" +
157+
"description='" + description + '\'' +
158+
", delivered=" + delivered +
159159
'}';
160160
}
161161
}
@@ -170,7 +170,7 @@ public static void main(String... args) {
170170

171171
server.doingMyJob() //
172172
.subscribe( //
173-
dish -> System.out.println("Consuming " + dish), //
173+
dish -> System.out.println("Consuming " + dish),
174174
throwable -> System.err.println(throwable));
175175
}
176176
}

5-reactive/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@
7979
<plugin>
8080
<groupId>org.springframework.boot</groupId>
8181
<artifactId>spring-boot-maven-plugin</artifactId>
82+
<!-- tag::docker[] -->
83+
<configuration>
84+
<layout>LAYERED_JAR</layout>
85+
</configuration>
86+
<!-- end::docker[] -->
8287
</plugin>
8388
</plugins>
8489
</build>

0 commit comments

Comments
 (0)