Skip to content

Commit 59048ae

Browse files
committed
Ch 4 code
1 parent da1cb61 commit 59048ae

File tree

100 files changed

+3892
-406
lines changed

Some content is hidden

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

100 files changed

+3892
-406
lines changed

10/part1/chat/build.gradle

+16-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// tag::propdeps-plugin-1[]
22
buildscript {
33
ext {
4-
springBootVersion = '1.4.3.RELEASE'
4+
springBootVersion = '2.0.0.BUILD-SNAPSHOT'
5+
thymeleafVersion = '3.0.4-SNAPSHOT'
56
}
67
repositories {
78
mavenCentral()
@@ -16,9 +17,13 @@ buildscript {
1617
}
1718
// end::propdeps-plugin-1[]
1819

19-
//plugins {
20-
// id "com.gorylenko.gradle-git-properties" version "1.4.17"
21-
//}
20+
plugins {
21+
id "io.spring.dependency-management" version "1.0.0.RC2"
22+
23+
// tag::gradle-git[]
24+
id "com.gorylenko.gradle-git-properties" version "1.4.17"
25+
// end::gradle-git[]
26+
}
2227

2328
apply plugin: 'java'
2429
apply plugin: 'eclipse'
@@ -39,6 +44,7 @@ repositories {
3944
maven { url "https://repo.spring.io/snapshot" }
4045
maven { url "https://repo.spring.io/milestone" }
4146
maven { url "https://repo.spring.io/release" }
47+
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
4248
maven { url "https://dl.bintray.com/rabbitmq/maven-milestones/" }
4349
}
4450

@@ -47,9 +53,12 @@ jar {
4753
version = '0.0.1-SNAPSHOT'
4854
}
4955

56+
ext['thymeleaf.version'] = thymeleafVersion
57+
5058
dependencies {
59+
compile('org.springframework.boot:spring-boot-starter-webflux')
5160
compile('org.springframework.boot:spring-boot-starter-actuator')
52-
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
61+
compile("org.thymeleaf:thymeleaf-spring5:${thymeleafVersion}")
5362
compile('org.springframework.boot:spring-boot-devtools')
5463
compile('org.projectlombok:lombok')
5564
compile('org.springframework.cloud:spring-cloud-starter-stream-rabbit')
@@ -80,9 +89,6 @@ dependencies {
8089
compile('org.thymeleaf.extras:thymeleaf-extras-springsecurity4:2.1.3.RELEASE')
8190
// end::thymeleaf-security[]
8291

83-
compile("io.projectreactor:reactor-core:2.0.8.RELEASE")
84-
compile("io.projectreactor:reactor-net:2.0.8.RELEASE")
85-
8692
// tag::configuration-processor[]
8793
optional "org.springframework.boot:spring-boot-configuration-processor"
8894
// end::configuration-processor[]
@@ -96,6 +102,7 @@ compileJava.dependsOn(processResources)
96102

97103
dependencyManagement {
98104
imports {
99-
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.SR2"
105+
mavenBom "io.projectreactor:reactor-bom:Aluminium-SR1"
106+
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Dalston.BUILD-SNAPSHOT"
100107
}
101108
}

10/part1/comments/build.gradle

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
buildscript {
22
ext {
3-
springBootVersion = '1.4.2.RELEASE'
3+
springBootVersion = '2.0.0.BUILD-SNAPSHOT'
44
}
55
repositories {
66
mavenCentral()
@@ -12,9 +12,13 @@ buildscript {
1212
}
1313
}
1414

15-
//plugins {
16-
// id "com.gorylenko.gradle-git-properties" version "1.4.17"
17-
//}
15+
plugins {
16+
id "io.spring.dependency-management" version "1.0.0.RC2"
17+
18+
// tag::gradle-git[]
19+
id "com.gorylenko.gradle-git-properties" version "1.4.17"
20+
// end::gradle-git[]
21+
}
1822

1923
apply plugin: 'java'
2024
apply plugin: 'eclipse'
@@ -39,7 +43,7 @@ ext['reactor.version'] = '3.0.3.RELEASE'
3943

4044
dependencies {
4145
compile('org.springframework.boot:spring-boot-starter-actuator')
42-
compile('org.springframework.boot:spring-boot-starter-data-mongodb')
46+
compile('org.springframework.boot:spring-boot-starter-data-mongodb-reactive')
4347
compile('org.springframework.boot:spring-boot-devtools')
4448
compile('org.springframework.cloud:spring-cloud-starter-stream-rabbit')
4549
compile('org.springframework.cloud:spring-cloud-starter-eureka')
@@ -55,6 +59,6 @@ dependencies {
5559

5660
dependencyManagement {
5761
imports {
58-
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.SR2"
62+
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Dalston.BUILD-SNAPSHOT"
5963
}
6064
}

10/part1/config-server/build.gradle

+8-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ buildscript {
1212
}
1313
}
1414

15-
//plugins {
16-
// id "com.gorylenko.gradle-git-properties" version "1.4.17"
17-
//}
15+
plugins {
16+
id "io.spring.dependency-management" version "1.0.0.RC2"
17+
18+
// tag::gradle-git[]
19+
id "com.gorylenko.gradle-git-properties" version "1.4.17"
20+
// end::gradle-git[]
21+
}
1822

1923
apply plugin: 'java'
2024
apply plugin: 'eclipse'
@@ -45,7 +49,7 @@ dependencies {
4549

4650
dependencyManagement {
4751
imports {
48-
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.SR2"
52+
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Dalston.BUILD-SNAPSHOT"
4953
}
5054
}
5155
// end::code[]

10/part1/eureka-server/build.gradle

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
buildscript {
22
ext {
3-
springBootVersion = '1.4.1.RELEASE'
3+
springBootVersion = '2.0.0.BUILD-SNAPSHOT'
44
}
55
repositories {
66
mavenCentral()
@@ -12,13 +12,17 @@ buildscript {
1212
}
1313
}
1414

15-
//plugins {
16-
// id "com.gorylenko.gradle-git-properties" version "1.4.17"
17-
//}
15+
plugins {
16+
id "io.spring.dependency-management" version "1.0.0.RC2"
17+
18+
// tag::gradle-git[]
19+
id "com.gorylenko.gradle-git-properties" version "1.4.17"
20+
// end::gradle-git[]
21+
}
1822

1923
apply plugin: 'java'
2024
apply plugin: 'eclipse'
21-
apply plugin: 'spring-boot'
25+
apply plugin: 'org.springframework.boot'
2226

2327
sourceCompatibility = 1.8
2428
targetCompatibility = 1.8
@@ -48,6 +52,6 @@ dependencies {
4852

4953
dependencyManagement {
5054
imports {
51-
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.SR2"
55+
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Dalston.BUILD-SNAPSHOT"
5256
}
5357
}

10/part1/hystrix-dashboard/build.gradle

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
buildscript {
22
ext {
3-
springBootVersion = '1.4.1.RELEASE'
3+
springBootVersion = '2.0.0.BUILD-SNAPSHOT'
44
}
55
repositories {
66
mavenCentral()
@@ -12,13 +12,17 @@ buildscript {
1212
}
1313
}
1414

15-
//plugins {
16-
// id "com.gorylenko.gradle-git-properties" version "1.4.17"
17-
//}
15+
plugins {
16+
id "io.spring.dependency-management" version "1.0.0.RC2"
17+
18+
// tag::gradle-git[]
19+
id "com.gorylenko.gradle-git-properties" version "1.4.17"
20+
// end::gradle-git[]
21+
}
1822

1923
apply plugin: 'java'
2024
apply plugin: 'eclipse'
21-
apply plugin: 'spring-boot'
25+
apply plugin: 'org.springframework.boot'
2226

2327
sourceCompatibility = 1.8
2428
targetCompatibility = 1.8
@@ -42,7 +46,7 @@ dependencies {
4246

4347
dependencyManagement {
4448
imports {
45-
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.SR2"
49+
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Dalston.BUILD-SNAPSHOT"
4650
}
4751
}
4852
// end::code[]

10/part1/images/build.gradle

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
buildscript {
22
ext {
3-
springBootVersion = '1.4.2.RELEASE'
3+
springBootVersion = '2.0.0.BUILD-SNAPSHOT'
4+
thymeleafVersion = '3.0.4-SNAPSHOT'
45
}
56
repositories {
67
mavenCentral()
@@ -12,9 +13,13 @@ buildscript {
1213
}
1314
}
1415

15-
//plugins {
16-
// id "com.gorylenko.gradle-git-properties" version "1.4.17"
17-
//}
16+
plugins {
17+
id "io.spring.dependency-management" version "1.0.0.RC2"
18+
19+
// tag::gradle-git[]
20+
id "com.gorylenko.gradle-git-properties" version "1.4.17"
21+
// end::gradle-git[]
22+
}
1823

1924
apply plugin: 'java'
2025
apply plugin: 'eclipse'
@@ -27,6 +32,7 @@ repositories {
2732
mavenCentral()
2833
maven { url "https://repo.spring.io/snapshot" }
2934
maven { url "https://repo.spring.io/milestone" }
35+
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
3036
maven { url "https://dl.bintray.com/rabbitmq/maven-milestones/" }
3137
}
3238

@@ -35,12 +41,13 @@ jar {
3541
version = '0.0.1-SNAPSHOT'
3642
}
3743

38-
ext['reactor.version'] = '3.0.3.RELEASE'
44+
ext['thymeleaf.version'] = thymeleafVersion
3945

4046
dependencies {
47+
compile('org.springframework.boot:spring-boot-starter-webflux')
48+
compile('org.springframework.boot:spring-boot-starter-data-mongodb-reactive')
49+
compile("org.thymeleaf:thymeleaf-spring5:${thymeleafVersion}")
4150
compile('org.springframework.boot:spring-boot-starter-actuator')
42-
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
43-
compile('org.springframework.boot:spring-boot-starter-data-mongodb')
4451
compile('org.springframework.boot:spring-boot-devtools')
4552
compile('org.springframework.cloud:spring-cloud-starter-stream-rabbit')
4653
compile('org.springframework.cloud:spring-cloud-starter-eureka')
@@ -62,6 +69,7 @@ dependencies {
6269

6370
dependencyManagement {
6471
imports {
65-
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.SR2"
72+
mavenBom "io.projectreactor:reactor-bom:Aluminium-SR1"
73+
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Dalston.BUILD-SNAPSHOT"
6674
}
6775
}

2/part1/src/main/java/com/greglturnquist/learningspringboot/ReactiveThymeleafConfig.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
import org.springframework.context.ApplicationContext;
2121
import org.springframework.context.annotation.Bean;
2222
import org.springframework.context.annotation.Configuration;
23-
import org.thymeleaf.spring5.ISpringWebReactiveTemplateEngine;
24-
import org.thymeleaf.spring5.SpringWebReactiveTemplateEngine;
23+
import org.thymeleaf.spring5.SpringWebFluxTemplateEngine;
2524
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
2625
import org.thymeleaf.spring5.view.reactive.ThymeleafReactiveViewResolver;
2726

@@ -42,7 +41,7 @@ public ReactiveThymeleafConfig(ThymeleafProperties thymeleafProperties) {
4241

4342
// tag::4[]
4443
@Bean
45-
public ThymeleafReactiveViewResolver thymeleafFullModeViewResolver(ISpringWebReactiveTemplateEngine templateEngine){
44+
public ThymeleafReactiveViewResolver thymeleafFullModeViewResolver(SpringWebFluxTemplateEngine templateEngine){
4645
final ThymeleafReactiveViewResolver viewResolver = new ThymeleafReactiveViewResolver();
4746
viewResolver.setTemplateEngine(templateEngine);
4847
viewResolver.setResponseMaxChunkSizeBytes(16384);
@@ -52,10 +51,10 @@ public ThymeleafReactiveViewResolver thymeleafFullModeViewResolver(ISpringWebRea
5251

5352
// tag::3[]
5453
@Bean
55-
public ISpringWebReactiveTemplateEngine thymeleafTemplateEngine(SpringResourceTemplateResolver templateResolver){
54+
public SpringWebFluxTemplateEngine thymeleafTemplateEngine(SpringResourceTemplateResolver templateResolver){
5655
// We override here the SpringTemplateEngine instance that would otherwise be instantiated by
5756
// Spring Boot because we want to apply the SpringReactive-specific context factory, link builder...
58-
final SpringWebReactiveTemplateEngine templateEngine = new SpringWebReactiveTemplateEngine();
57+
final SpringWebFluxTemplateEngine templateEngine = new SpringWebFluxTemplateEngine();
5958
templateEngine.setTemplateResolver(templateResolver);
6059
return templateEngine;
6160
}

2/part2/src/main/java/com/greglturnquist/learningspringboot/ReactiveThymeleafConfig.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
import org.springframework.context.ApplicationContext;
2121
import org.springframework.context.annotation.Bean;
2222
import org.springframework.context.annotation.Configuration;
23-
import org.thymeleaf.spring5.ISpringWebReactiveTemplateEngine;
24-
import org.thymeleaf.spring5.SpringWebReactiveTemplateEngine;
23+
24+
import org.thymeleaf.spring5.SpringWebFluxTemplateEngine;
2525
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
2626
import org.thymeleaf.spring5.view.reactive.ThymeleafReactiveViewResolver;
2727

@@ -71,11 +71,11 @@ public SpringResourceTemplateResolver thymeleafTemplateResolver(
7171

7272
// tag::3[]
7373
@Bean
74-
public ISpringWebReactiveTemplateEngine thymeleafTemplateEngine(
74+
public SpringWebFluxTemplateEngine thymeleafTemplateEngine(
7575
SpringResourceTemplateResolver templateResolver) {
7676

77-
final SpringWebReactiveTemplateEngine templateEngine =
78-
new SpringWebReactiveTemplateEngine();
77+
final SpringWebFluxTemplateEngine templateEngine =
78+
new SpringWebFluxTemplateEngine();
7979
templateEngine.setTemplateResolver(templateResolver);
8080
return templateEngine;
8181
}
@@ -84,7 +84,7 @@ public ISpringWebReactiveTemplateEngine thymeleafTemplateEngine(
8484
// tag::4[]
8585
@Bean
8686
public ThymeleafReactiveViewResolver thymeleafFullModeViewResolver(
87-
ISpringWebReactiveTemplateEngine templateEngine){
87+
SpringWebFluxTemplateEngine templateEngine){
8888

8989
final ThymeleafReactiveViewResolver viewResolver =
9090
new ThymeleafReactiveViewResolver();

3/part1/src/main/java/com/greglturnquist/learningspringboot/ReactiveThymeleafConfig.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@
1717

1818
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafProperties;
1919
import org.springframework.boot.context.properties.EnableConfigurationProperties;
20-
import org.springframework.context.ApplicationContext;
2120
import org.springframework.context.annotation.Bean;
2221
import org.springframework.context.annotation.Configuration;
2322

24-
import org.thymeleaf.spring5.ISpringWebReactiveTemplateEngine;
25-
import org.thymeleaf.spring5.SpringWebReactiveTemplateEngine;
23+
import org.thymeleaf.spring5.SpringWebFluxTemplateEngine;
2624
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
2725
import org.thymeleaf.spring5.view.reactive.ThymeleafReactiveViewResolver;
2826

@@ -43,7 +41,7 @@ public ReactiveThymeleafConfig(ThymeleafProperties thymeleafProperties) {
4341

4442
// tag::4[]
4543
@Bean
46-
public ThymeleafReactiveViewResolver thymeleafFullModeViewResolver(ISpringWebReactiveTemplateEngine templateEngine){
44+
public ThymeleafReactiveViewResolver thymeleafFullModeViewResolver(SpringWebFluxTemplateEngine templateEngine){
4745
final ThymeleafReactiveViewResolver viewResolver = new ThymeleafReactiveViewResolver();
4846
viewResolver.setTemplateEngine(templateEngine);
4947
viewResolver.setResponseMaxChunkSizeBytes(16384);
@@ -53,10 +51,10 @@ public ThymeleafReactiveViewResolver thymeleafFullModeViewResolver(ISpringWebRea
5351

5452
// tag::3[]
5553
@Bean
56-
public ISpringWebReactiveTemplateEngine thymeleafTemplateEngine(SpringResourceTemplateResolver templateResolver){
54+
public SpringWebFluxTemplateEngine thymeleafTemplateEngine(SpringResourceTemplateResolver templateResolver){
5755
// We override here the SpringTemplateEngine instance that would otherwise be instantiated by
5856
// Spring Boot because we want to apply the SpringReactive-specific context factory, link builder...
59-
final SpringWebReactiveTemplateEngine templateEngine = new SpringWebReactiveTemplateEngine();
57+
final SpringWebFluxTemplateEngine templateEngine = new SpringWebFluxTemplateEngine();
6058
templateEngine.setTemplateResolver(templateResolver);
6159
return templateEngine;
6260
}

0 commit comments

Comments
 (0)