web-dev-qa-db-fra.com

Spring WebFlux - Problèmes de sérialisation de ServerResponse Jackson

J'ai un problème lors de l'envoi d'une demande HTTP GET à mon serveur Web. Voici un extrait de code qui est responsable de cette ressource:

@GetMapping("/events")
public Mono<ServerResponse> getEvents() {
    return ServerResponse.ok()
              .contentType(APPLICATION_JSON)
              .build();
}

Lors de l'envoi d'une demande, je reçois une exception:

org.springframework.core.codec.CodecException: Type definition error: [simple type, class org.springframework.web.reactive.function.server.DefaultServerResponseBuilder$WriterFunctionServerResponse]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.springframework.web.reactive.function.server.DefaultServerResponseBuilder$WriterFunctionServerResponse and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)
at org.springframework.http.codec.json.AbstractJackson2Encoder.encodeValue(AbstractJackson2Encoder.Java:162) ~[spring-web-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.http.codec.json.AbstractJackson2Encoder.lambda$encode$0(AbstractJackson2Encoder.Java:119) ~[spring-web-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.Java:107) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxJust$WeakScalarSubscription.request(FluxJust.Java:91) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.Java:156) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.Java:1444) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.Java:1318) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.Java:90) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxJust.subscribe(FluxJust.Java:68) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxMapFuseable.subscribe(FluxMapFuseable.Java:63) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Flux.subscribe(Flux.Java:6873) ~[reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxConcatArray$ConcatArraySubscriber.onComplete(FluxConcatArray.Java:200) ~[reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxConcatArray.subscribe(FluxConcatArray.Java:80) ~[reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Flux.subscribe(Flux.Java:6873) ~[reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxConcatArray$ConcatArraySubscriber.onComplete(FluxConcatArray.Java:200) ~[reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxConcatArray.subscribe(FluxConcatArray.Java:80) ~[reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxMap.subscribe(FluxMap.Java:59) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxContextStart.subscribe(FluxContextStart.Java:49) ~[reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Flux.subscribe(Flux.Java:6873) ~[reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.ipc.netty.channel.ChannelOperationsHandler.drain(ChannelOperationsHandler.Java:461) ~[reactor-netty-0.7.6.RELEASE.jar:0.7.6.RELEASE]
at reactor.ipc.netty.channel.ChannelOperationsHandler.flush(ChannelOperationsHandler.Java:191) ~[reactor-netty-0.7.6.RELEASE.jar:0.7.6.RELEASE]
at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.Java:776) ~[netty-transport-4.1.23.Final.jar:4.1.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.Java:802) ~[netty-transport-4.1.23.Final.jar:4.1.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.Java:814) ~[netty-transport-4.1.23.Final.jar:4.1.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.Java:794) ~[netty-transport-4.1.23.Final.jar:4.1.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.Java:831) ~[netty-transport-4.1.23.Final.jar:4.1.23.Final]
at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.Java:1071) ~[netty-transport-4.1.23.Final.jar:4.1.23.Final]
at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.Java:300) ~[netty-transport-4.1.23.Final.jar:4.1.23.Final]
at reactor.ipc.netty.NettyOutbound.lambda$sendObject$6(NettyOutbound.Java:298) ~[reactor-netty-0.7.6.RELEASE.jar:0.7.6.RELEASE]
at reactor.ipc.netty.FutureMono$DeferredFutureMono.subscribe(FutureMono.Java:134) ~[reactor-netty-0.7.6.RELEASE.jar:0.7.6.RELEASE]
at reactor.core.publisher.Mono.subscribe(Mono.Java:3080) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.ipc.netty.NettyOutbound.subscribe(NettyOutbound.Java:356) ~[reactor-netty-0.7.6.RELEASE.jar:0.7.6.RELEASE]
at reactor.core.publisher.FluxConcatMap$ConcatMapDelayed.drain(FluxConcatMap.Java:749) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxConcatMap$ConcatMapDelayed.onNext(FluxConcatMap.Java:581) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.Java:108) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at org.springframework.http.server.reactive.ChannelSendOperator$WriteBarrier.emitCachedSignals(ChannelSendOperator.Java:282) [spring-web-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.http.server.reactive.ChannelSendOperator$WriteBarrier.request(ChannelSendOperator.Java:264) [spring-web-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at reactor.core.publisher.FluxMap$MapSubscriber.request(FluxMap.Java:149) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxConcatMap$ConcatMapDelayed.onSubscribe(FluxConcatMap.Java:567) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxMap$MapSubscriber.onSubscribe(FluxMap.Java:86) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at org.springframework.http.server.reactive.ChannelSendOperator$WriteBarrier.subscribe(ChannelSendOperator.Java:317) [spring-web-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at reactor.core.publisher.FluxSource.subscribe(FluxSource.Java:52) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxMap.subscribe(FluxMap.Java:62) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxConcatMap.subscribe(FluxConcatMap.Java:121) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoIgnoreElements.subscribe(MonoIgnoreElements.Java:37) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.drain(MonoIgnoreThen.Java:148) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.Java:56) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Mono.subscribe(Mono.Java:3080) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxConcatIterable$ConcatIterableSubscriber.onComplete(FluxConcatIterable.Java:141) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxConcatIterable.subscribe(FluxConcatIterable.Java:60) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoIgnoreElements.subscribe(MonoIgnoreElements.Java:37) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Mono.subscribe(Mono.Java:3080) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at org.springframework.http.server.reactive.ChannelSendOperator$WriteBarrier.onNext(ChannelSendOperator.Java:181) [spring-web-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.Java:115) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxJust$WeakScalarSubscription.request(FluxJust.Java:91) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.Java:156) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at org.springframework.http.server.reactive.ChannelSendOperator$WriteBarrier.onSubscribe(ChannelSendOperator.Java:163) [spring-web-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.Java:90) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxJust.subscribe(FluxJust.Java:68) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxMapFuseable.subscribe(FluxMapFuseable.Java:63) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at org.springframework.http.server.reactive.ChannelSendOperator.subscribe(ChannelSendOperator.Java:74) [spring-web-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at reactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.Java:44) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.Java:150) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.Java:1073) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.Java:241) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.Java:73) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.Java:198) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.Java:198) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.Java:1073) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoIgnoreThen$ThenAcceptInner.onNext(MonoIgnoreThen.Java:290) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.Java:1073) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.Java:144) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.Java:1073) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoZip$ZipCoordinator.signal(MonoZip.Java:241) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoZip$ZipInner.onNext(MonoZip.Java:323) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.Java:185) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxDefaultIfEmpty$DefaultIfEmptySubscriber.onNext(FluxDefaultIfEmpty.Java:92) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.Java:67) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.Java:115) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.Java:1630) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.Java:156) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.Java:1444) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.Java:1318) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.Java:90) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoJust.subscribe(MonoJust.Java:54) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoMapFuseable.subscribe(MonoMapFuseable.Java:59) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoSwitchIfEmpty.subscribe(MonoSwitchIfEmpty.Java:44) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoDefaultIfEmpty.subscribe(MonoDefaultIfEmpty.Java:37) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoPeek.subscribe(MonoPeek.Java:71) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Mono.subscribe(Mono.Java:3080) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoZip.subscribe(MonoZip.Java:128) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoFlatMap.subscribe(MonoFlatMap.Java:60) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.Java:52) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.drain(MonoIgnoreThen.Java:148) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.Java:56) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoPeekFuseable.subscribe(MonoPeekFuseable.Java:74) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoPeekFuseable.subscribe(MonoPeekFuseable.Java:74) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.Java:44) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.Java:150) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.Java:67) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.Java:76) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.innerNext(FluxConcatMap.Java:271) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onNext(FluxConcatMap.Java:803) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.Java:115) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.Java:1630) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.Java:156) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.Java:1444) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.Java:1318) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.Java:90) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoJust.subscribe(MonoJust.Java:54) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoMapFuseable.subscribe(MonoMapFuseable.Java:59) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Mono.subscribe(Mono.Java:3080) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.Java:418) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.onSubscribe(FluxConcatMap.Java:210) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.Java:128) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.Java:61) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.FluxConcatMap.subscribe(FluxConcatMap.Java:121) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoNext.subscribe(MonoNext.Java:40) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoSwitchIfEmpty.subscribe(MonoSwitchIfEmpty.Java:44) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoFlatMap.subscribe(MonoFlatMap.Java:60) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoFlatMap.subscribe(MonoFlatMap.Java:60) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.Java:44) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.Java:44) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.Java:44) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.Mono.subscribe(Mono.Java:3080) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.drain(MonoIgnoreThen.Java:167) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.Java:56) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoPeekFuseable.subscribe(MonoPeekFuseable.Java:70) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.core.publisher.MonoPeekTerminal.subscribe(MonoPeekTerminal.Java:61) [reactor-core-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.ipc.netty.channel.ChannelOperations.applyHandler(ChannelOperations.Java:381) [reactor-netty-0.7.6.RELEASE.jar:0.7.6.RELEASE]
at reactor.ipc.netty.http.server.HttpServerOperations.onHandlerStart(HttpServerOperations.Java:397) [reactor-netty-0.7.6.RELEASE.jar:0.7.6.RELEASE]
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute$$$capture(AbstractEventExecutor.Java:163) ~[netty-common-4.1.23.Final.jar:4.1.23.Final]
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.Java) ~[netty-common-4.1.23.Final.jar:4.1.23.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.Java:404) ~[netty-common-4.1.23.Final.jar:4.1.23.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.Java:463) ~[netty-transport-4.1.23.Final.jar:4.1.23.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.Java:886) ~[netty-common-4.1.23.Final.jar:4.1.23.Final]
at Java.lang.Thread.run(Thread.Java:748) ~[na:1.8.0_141]
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.springframework.web.reactive.function.server.DefaultServerResponseBuilder$WriterFunctionServerResponse and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)
at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.Java:77) ~[jackson-databind-2.9.5.jar:2.9.5]
at com.fasterxml.jackson.databind.SerializerProvider.reportBadDefinition(SerializerProvider.Java:1191) ~[jackson-databind-2.9.5.jar:2.9.5]
at com.fasterxml.jackson.databind.DatabindContext.reportBadDefinition(DatabindContext.Java:312) ~[jackson-databind-2.9.5.jar:2.9.5]
at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.Java:71) ~[jackson-databind-2.9.5.jar:2.9.5]
at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.serialize(UnknownSerializer.Java:33) ~[jackson-databind-2.9.5.jar:2.9.5]
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.Java:480) ~[jackson-databind-2.9.5.jar:2.9.5]
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.Java:319) ~[jackson-databind-2.9.5.jar:2.9.5]
at com.fasterxml.jackson.databind.ObjectWriter$Prefetch.serialize(ObjectWriter.Java:1396) ~[jackson-databind-2.9.5.jar:2.9.5]
at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.Java:913) ~[jackson-databind-2.9.5.jar:2.9.5]
at org.springframework.http.codec.json.AbstractJackson2Encoder.encodeValue(AbstractJackson2Encoder.Java:159) ~[spring-web-5.0.5.RELEASE.jar:5.0.5.RELEASE]
... 136 common frames omitted

J'utilise Spring Boot 2.0.1.RELEASE. Pourriez-vous m'aider à résoudre ce problème? Je vous serais reconnaissant.

10
Marcin Borowski

ServerResponse est le type de réponse HTTP utilisé par Spring WebFlux.fn, la variante fonctionnelle du framework web réactif. Vous n'êtes pas censé l'utiliser dans un contrôleur annoté.

Dans ce cas, vous devez renvoyer un ResponseEntity à la place (ou tout autre type de retour pris en charge, voir la documentation de référence ).

11
Brian Clozel