Вот мой основной класс
@SpringBootApplication
@ComponentScan(basePackages= {"com.test"
})
public class Application {
public static void main(String... args) {
System.setProperty("spring.devtools.restart.enabled", "false");
Properties props = BootProperties.forService(
"test", "test", "test");
new SpringApplicationBuilder(
Application.class)
.properties(props)
.run(args);
}
RestController
@RestController
public class PersonController {
private ARepository aRepo;
PersonController(ARepository aRepo) {
this.aRepo = aRepo;
}
@PostMapping(path = "/books", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public Mono<VO> createBook(@Valid @RequestBody VO vo) {
return apply(vo);
}
public Mono<VO> apply(VO vo) {
Mono<VO> alternate = Mono.fromCallable(() -> {
return aRepo.findById(vo.getId1(), vo.getId2());
}).flatMapMany(Flux::fromIterable).next().map(n -> build(vo, n)).subscribeOn(Schedulers.elastic());
return alternate;
}