I'm trying to return an Observable from a Spring RestController without any success. My code is the following:
@RestController
public class HystrixCommentController {
@GetMapping(value = "/com1/{id}")
public Observable<Comment> getComment1(@PathVariable int id) {
return Observable.just(new Comment());
}
}
When run the request in postman I alway get the following error :
{
"timestamp": "2018-07-08T16:07:36.809+0000",
"status": 500,
"error": "Internal Server Error",
"message": "No converter found for return value of type: class rx.internal.util.ScalarSynchronousObservable",
"path": "/com1/1"
}
Doesn't SpringBoot 2 also support rx.Observable in the RestController like they do with Mono/Flux ?
Do I need to transform manually the Observable to a Mono/Flux ?
Regards
Note: spring-boot-starter-webflux is included in the pom
I tried this :
@RestController
public class HystrixCommentController {
@GetMapping(value = "/com1/{id}", produces = "application/json")
public Observable<Comment> getComment1(@PathVariable int id) {
return Observable.just(new Comment());
}
}
With no success :
{
"timestamp": "2018-07-08T18:21:42.918+0000",
"status": 406,
"error": "Not Acceptable",
"message": "Could not find acceptable representation",
"path": "/com1/1"
}