File tree 10 files changed +18
-19
lines changed
src/main/java/com/greglturnquist/learningspringboot
src/main/java/com/greglturnquist/learningspringboot
10 files changed +18
-19
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,7 @@ ext['thymeleaf.version'] = thymeleafVersion
41
41
dependencies {
42
42
compile(' org.springframework.boot:spring-boot-starter-webflux' )
43
43
// tag::dep-1[]
44
- compile(' org.springframework.boot:spring-boot-starter-data-mongodb' )
45
- compile(' org.mongodb:mongodb-driver-reactivestreams' )
44
+ compile(' org.springframework.boot:spring-boot-starter-data-mongodb-reactive' )
46
45
// end::dep-1[]
47
46
compile(" org.thymeleaf:thymeleaf-spring5:${ thymeleafVersion} " )
48
47
compile(' org.projectlombok:lombok' )
@@ -53,7 +52,5 @@ dependencies {
53
52
dependencyManagement {
54
53
imports {
55
54
mavenBom " io.projectreactor:reactor-bom:Aluminium-SR1"
56
- // tag::dep-2[]
57
- // end::dep-2[]
58
55
}
59
56
}
Original file line number Diff line number Diff line change 22
22
* @author Greg Turnquist
23
23
*/
24
24
// tag::code[]
25
- public interface ImageRepository extends ReactiveCrudRepository <Image , String > {
25
+ public interface ImageRepository
26
+ extends ReactiveCrudRepository <Image , String > {
26
27
27
28
Mono <Image > findByName (String name );
28
29
}
Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ public class ImageService {
46
46
47
47
private final ImageRepository imageRepository ;
48
48
49
- public ImageService (ResourceLoader resourceLoader , ImageRepository imageRepository ) {
49
+ public ImageService (ResourceLoader resourceLoader ,
50
+ ImageRepository imageRepository ) {
50
51
this .resourceLoader = resourceLoader ;
51
52
this .imageRepository = imageRepository ;
52
53
}
Original file line number Diff line number Diff line change @@ -51,7 +51,8 @@ public void run(String... args) throws Exception {
51
51
))
52
52
.then (() -> repository .findAll ().collectList ())
53
53
.then (images -> {
54
- images .forEach (image -> System .out .println (image .toString ()));
54
+ images .forEach (image ->
55
+ System .out .println (image .toString ()));
55
56
return Mono .empty ();
56
57
})
57
58
.block (Duration .ofSeconds (30 ));
Original file line number Diff line number Diff line change @@ -40,10 +40,7 @@ ext['thymeleaf.version'] = thymeleafVersion
40
40
41
41
dependencies {
42
42
compile(' org.springframework.boot:spring-boot-starter-webflux' )
43
- // tag::dep-1[]
44
- compile(' org.springframework.boot:spring-boot-starter-data-mongodb' )
45
- compile(' org.mongodb:mongodb-driver-reactivestreams' )
46
- // end::dep-1[]
43
+ compile(' org.springframework.boot:spring-boot-starter-data-mongodb-reactive' )
47
44
compile(" org.thymeleaf:thymeleaf-spring5:${ thymeleafVersion} " )
48
45
compile(' org.projectlombok:lombok' )
49
46
testCompile(' org.springframework.boot:spring-boot-starter-test' )
@@ -53,7 +50,5 @@ dependencies {
53
50
dependencyManagement {
54
51
imports {
55
52
mavenBom " io.projectreactor:reactor-bom:Aluminium-SR1"
56
- // tag::dep-2[]
57
- // end::dep-2[]
58
53
}
59
54
}
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ public Mono<String> createFile(Flux<MultipartFile> files) {
81
81
@ PostMapping (BASE_PATH + "/" + FILENAME )
82
82
public Mono <String > deleteFile (@ PathVariable String filename ) {
83
83
return imageService .deleteImage (filename )
84
- .then (() -> Mono . just ( "redirect:/" ) );
84
+ .map ( aVoid -> "redirect:/" );
85
85
}
86
86
87
87
}
Original file line number Diff line number Diff line change 22
22
* @author Greg Turnquist
23
23
*/
24
24
// tag::code[]
25
- public interface ImageRepository extends ReactiveCrudRepository <Image , String > {
25
+ public interface ImageRepository
26
+ extends ReactiveCrudRepository <Image , String > {
26
27
27
28
Mono <Image > findByName (String name );
28
29
}
Original file line number Diff line number Diff line change @@ -45,7 +45,8 @@ public class ImageService {
45
45
46
46
private final ImageRepository imageRepository ;
47
47
48
- public ImageService (ResourceLoader resourceLoader , ImageRepository imageRepository ) {
48
+ public ImageService (ResourceLoader resourceLoader ,
49
+ ImageRepository imageRepository ) {
49
50
this .resourceLoader = resourceLoader ;
50
51
this .imageRepository = imageRepository ;
51
52
}
Original file line number Diff line number Diff line change @@ -42,11 +42,11 @@ public void run(String... args) throws Exception {
42
42
.then (() -> Mono .when (
43
43
repository .save (
44
44
new Image ("1" ,
45
- "learning-spring-boot.png " ))
45
+ "learning-spring-boot-cover.jpg " ))
46
46
.log ("initDatabase" ),
47
47
repository .save (
48
48
new Image ("2" ,
49
- "learning-spring-boot-2nd-edition.png " ))
49
+ "learning-spring-boot-2nd-edition-cover.jpg " ))
50
50
.log ("initDatabase" ),
51
51
repository .save (
52
52
new Image ("3" ,
@@ -57,7 +57,8 @@ public void run(String... args) throws Exception {
57
57
.then (() -> repository .findAll ().collectList ())
58
58
.log ("initDatabase" )
59
59
.then (images -> {
60
- images .forEach (image -> System .out .println (image .toString ()));
60
+ images .forEach (image ->
61
+ System .out .println (image .toString ()));
61
62
return Mono .empty ();
62
63
})
63
64
.log ("initDatabase" )
Original file line number Diff line number Diff line change 21
21
import org .springframework .context .annotation .Bean ;
22
22
import org .springframework .context .annotation .Configuration ;
23
23
24
+ import org .springframework .web .reactive .result .view .UrlBasedViewResolver ;
24
25
import org .thymeleaf .spring5 .ISpringWebReactiveTemplateEngine ;
25
26
import org .thymeleaf .spring5 .SpringWebReactiveTemplateEngine ;
26
27
import org .thymeleaf .spring5 .templateresolver .SpringResourceTemplateResolver ;
You can’t perform that action at this time.
0 commit comments