forked from mzubal/spring-reactor-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PesonServletApplication.kt
35 lines (27 loc) · 964 Bytes
/
PesonServletApplication.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package cz.zubal.person
import io.codearte.jfairy.Fairy
import io.codearte.jfairy.producer.person.Person
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
@SpringBootApplication
class PersonReactiveApplication
fun main(args: Array<String>) {
runApplication<PersonReactiveApplication>(*args)
}
@RestController
@RequestMapping("/person")
class PersonController {
val fairy : Fairy = Fairy.create()
@GetMapping
fun persons(@RequestParam number : Long) : List<Person> {
return (1..number).map { generatePerson() }
}
private fun generatePerson() : Person {
Thread.sleep(1000)
return fairy.person()
}
}