# kotlin-app **Repository Path**: chenbichao/kotlin-app ## Basic Information - **Project Name**: kotlin-app - **Description**: Kotlin + Spring Boot 2.0 开发REST API应用 - **Primary Language**: Kotlin - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 2 - **Created**: 2018-09-06 - **Last Updated**: 2024-08-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #Kotlin快速开发Spring Boot接口应用 ##1.数据保存部分: bean { ApplicationRunner { val bookRepository = ref() bookRepository.deleteAll() .thenMany( Flux.fromStream( Stream.generate { "Spring 空间【${UUID.randomUUID()}】" } .limit(30))) .map { Book(it, "Michael Chen", Date()) } .flatMap { bookRepository.save(it) } .thenMany(bookRepository.findAll()) .subscribe { println(it) } } } ##2. REST接口展示后台数据 bean { val bookRepository = ref() val interval = Flux.interval(Duration.ofMillis(100)) router { GET("/books") { ServerResponse.ok() .contentType(MediaType.TEXT_EVENT_STREAM) .body(Flux.zip(interval, bookRepository.findAll()).map { it.t2 }) } } }