Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
implementation 'de.flapdoodle.embed:de.flapdoodle.embed.mongo'
implementation 'org.synchronoss.cloud:nio-multipart-parser:1.1.0'
implementation 'org.jetbrains.kotlin:kotlin-reflect'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import risdon.learningspringboot.repository.ChapterRepository
class LoadDatabase {

@Bean
fun commandLineRunner(repository: ChapterRepository) = CommandLineRunner{
fun commandLineRunner(repository: ChapterRepository) = CommandLineRunner {
Flux.just(
Chapter(name = "Quick Start"),
Chapter(name = "Reactive programming"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package risdon.learningspringboot.controllers

import org.springframework.web.bind.annotation.*
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
import risdon.learningspringboot.model.Chapter
import risdon.learningspringboot.model.Image
import risdon.learningspringboot.repository.ChapterRepository

@RestController
class ImageController () {

@GetMapping("/images")
fun images(): Flux<Image> {
return Flux.just(
Image("1", "Chapter 1.jpg"),
Image("2", "Chapter 2.jpg"),
Image("3", "Chapter 3.jpg")
)
}

@PostMapping("/images")
fun create(@RequestBody images: Flux<Image>): Mono<Void> {
return images.map {
println("We will save $it to a database soon")
it
}
.then()
}
}
5 changes: 5 additions & 0 deletions src/main/kotlin/risdon/learningspringboot/model/Image.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package risdon.learningspringboot.model

import org.springframework.data.annotation.Id

data class Image (@Id var id: String? = null, var name: String? = null )
1 change: 0 additions & 1 deletion src/main/resources/application.properties

This file was deleted.

10 changes: 10 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
management:
endpoints:
web:
exposure:
include: info,health,metrics,beans
logging:
level:
io:
netty: DEBUG
reactor: DEBUG