Spring Spring Boot2.1.0を使用しています。
public Mono<ServerResponse> getConvertXmlToJson(ServerRequest serverRequest) {
Mono<String> requestString = serverRequest.bodyToMono(String.class);
Mono<String> response = this.convertFormatService.convertXmlToJson(requestString);
return response.subscribeOn(elastic()).flatMap(rta -> ok()
.contentType(APPLICATION_JSON_UTF8)
.body(fromObject(rta)))
.switchIfEmpty(ServerResponse.badRequest().build());
}
他のBeanでこのメソッドを呼び出す
private Mono<String> converter(String function, Mono<String> stringToConverter, String setting) {
log.info("salida, {}", stringToConverter.block());
try {
Object result = invocable.invokeFunction(function, stringToConverter, setting);
log.info("{}", result);
return Mono.just((String) result);
} catch (Exception e) {
throw new ConverterException(e.getMessage());
}
}
モノラルではなく文字列値を渡す必要があります。モノラルを渡すと、答えは空になります。
Monoから文字列値を取得しようとすると、次のエラーが発生します。
{
"timestamp": "2018-11-13T03:29:02.161+0000",
"path": "/v1/convert",
"status": 500,
"error": "Internal Server Error",
"message": "block()/blockFirst()/blockLast() are blocking, which is not supported in thread reactor-http-nio-3",
"trace": "Java.lang.IllegalStateException: block()/blockFirst()/blockLast() are blocking, which is not supported in thread reactor-http-nio-3\r\n\tat reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.Java:77)\r\n\tat reactor.core.publisher.Mono.block(Mono.Java:1475)\r\n\tat lf.co.com.examplespringconverterxmljson.services.impl.ConvertFormatServiceImpl.converter(ConvertFormatServiceImpl.Java:58)\r\n\tat lf.co.com.examplespringconverterxmljson.services.impl.ConvertFormatServiceImpl.convertXmlToJson(ConvertFormatServiceImpl.Java:49)\r\n\tat lf.co.com.examplespringconverterxmljson.routing.handler.ConvertHandler.getConvertXmlToJson(ConvertHandler.Java:25)\r\n\tat org.springframework.web.reactive.function.server.support.HandlerFunctionAdapter.handle(HandlerFunctionAdapter.Java:61)\r\n\tat org.springframework.web.reactive.DispatcherHandler.invokeHandler(DispatcherHandler.Java:159)\r\n\tat org.springframework.web.reactive.DispatcherHandler.lambda$handle$1(DispatcherHandler.Java:151)\r\n\tat reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.Java:118)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.Java:373)\r\n\tat reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.Java:67)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.Java:373)\r\n\tat reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.Java:76)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.Java:373)\r\n\tat reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.innerNext(FluxConcatMap.Java:275)\r\n\tat reactor.core.publisher.FluxConcatMap$ConcatMapInner.onNext(FluxConcatMap.Java:849)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.Java:373)\r\n\tat reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.Java:121)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.Java:373)\r\n\tat reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.Java:204)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.Java:373)\r\n\tat reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.Java:204)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.Java:373)\r\n\tat reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.Java:67)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.Java:373)\r\n\tat reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.Java:114)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.Java:373)\r\n\tat reactor.core.publisher.Operators$ScalarSubscription.request(Operators.Java:2041)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.request(FluxOnAssembly.Java:458)\r\n\tat reactor.core.publisher.FluxMap$MapSubscriber.request(FluxMap.Java:155)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.request(FluxOnAssembly.Java:458)\r\n\tat reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.Java:1849)\r\n\tat reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.Java:1723)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onSubscribe(FluxOnAssembly.Java:442)\r\n\tat reactor.core.publisher.FluxMap$MapSubscriber.onSubscribe(FluxMap.Java:86)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onSubscribe(FluxOnAssembly.Java:442)\r\n\tat reactor.core.publisher.MonoJust.subscribe(MonoJust.Java:54)\r\n\tat reactor.core.publisher.MonoCallableOnAssembly.subscribe(MonoCallableOnAssembly.Java:82)\r\n\tat reactor.core.publisher.MonoMap.subscribe(MonoMap.Java:55)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.MonoSwitchIfEmpty.subscribe(MonoSwitchIfEmpty.Java:44)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.MonoPeekFuseable.subscribe(MonoPeekFuseable.Java:74)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.MonoPeekFuseable.subscribe(MonoPeekFuseable.Java:74)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.MonoMapFuseable.subscribe(MonoMapFuseable.Java:59)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.Mono.subscribe(Mono.Java:3590)\r\n\tat reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.Java:442)\r\n\tat reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.onSubscribe(FluxConcatMap.Java:212)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onSubscribe(FluxOnAssembly.Java:442)\r\n\tat reactor.core.publisher.FluxIterable.subscribe(FluxIterable.Java:139)\r\n\tat reactor.core.publisher.FluxIterable.subscribe(FluxIterable.Java:63)\r\n\tat reactor.core.publisher.FluxOnAssembly.subscribe(FluxOnAssembly.Java:164)\r\n\tat reactor.core.publisher.FluxConcatMap.subscribe(FluxConcatMap.Java:121)\r\n\tat reactor.core.publisher.FluxOnAssembly.subscribe(FluxOnAssembly.Java:164)\r\n\tat reactor.core.publisher.MonoNext.subscribe(MonoNext.Java:40)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.MonoSwitchIfEmpty.subscribe(MonoSwitchIfEmpty.Java:44)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.MonoFlatMap.subscribe(MonoFlatMap.Java:60)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.MonoFlatMap.subscribe(MonoFlatMap.Java:60)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.MonoDefer.subscribe(MonoDefer.Java:52)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.Java:150)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.Java:373)\r\n\tat reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.Java:121)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.Java:373)\r\n\tat reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.Java:1476)\r\n\tat reactor.core.publisher.MonoProcessor.onNext(MonoProcessor.Java:389)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.Java:373)\r\n\tat reactor.core.publisher.Operators$ScalarSubscription.request(Operators.Java:2041)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.request(FluxOnAssembly.Java:458)\r\n\tat reactor.core.publisher.MonoProcessor.onSubscribe(MonoProcessor.Java:399)\r\n\tat reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onSubscribe(FluxOnAssembly.Java:442)\r\n\tat reactor.core.publisher.MonoJust.subscribe(MonoJust.Java:54)\r\n\tat reactor.core.publisher.MonoCallableOnAssembly.subscribe(MonoCallableOnAssembly.Java:82)\r\n\tat reactor.core.publisher.Mono.subscribe(Mono.Java:3590)\r\n\tat reactor.core.publisher.MonoProcessor.add(MonoProcessor.Java:531)\r\n\tat reactor.core.publisher.MonoProcessor.subscribe(MonoProcessor.Java:444)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.MonoMapFuseable.subscribe(MonoMapFuseable.Java:59)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.MonoFlatMap.subscribe(MonoFlatMap.Java:60)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.MonoDefer.subscribe(MonoDefer.Java:52)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.Java:44)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.Java:44)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:71)\r\n\tat reactor.core.publisher.MonoPeekTerminal.subscribe(MonoPeekTerminal.Java:61)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.Java:44)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.core.publisher.Mono.subscribe(Mono.Java:3590)\r\n\tat reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.drain(MonoIgnoreThen.Java:172)\r\n\tat reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.Java:56)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:71)\r\n\tat reactor.core.publisher.MonoPeekFuseable.subscribe(MonoPeekFuseable.Java:70)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:71)\r\n\tat reactor.core.publisher.MonoPeekTerminal.subscribe(MonoPeekTerminal.Java:61)\r\n\tat reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.Java:76)\r\n\tat reactor.netty.http.server.HttpServerHandle.onStateChange(HttpServerHandle.Java:64)\r\n\tat reactor.netty.tcp.TcpServerBind$ChildObserver.onStateChange(TcpServerBind.Java:226)\r\n\tat reactor.netty.http.server.HttpServerOperations.onInboundNext(HttpServerOperations.Java:431)\r\n\tat reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.Java:141)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:362)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:348)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.Java:340)\r\n\tat reactor.netty.http.server.HttpTrafficHandler.channelRead(HttpTrafficHandler.Java:159)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:362)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:348)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.Java:340)\r\n\tat io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.Java:438)\r\n\tat io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.Java:310)\r\n\tat io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.Java:297)\r\n\tat io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.Java:413)\r\n\tat io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.Java:265)\r\n\tat io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.Java:253)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:362)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:348)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.Java:340)\r\n\tat io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.Java:1434)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:362)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:348)\r\n\tat io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.Java:965)\r\n\tat io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.Java:163)\r\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.Java:628)\r\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.Java:563)\r\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.Java:480)\r\n\tat io.netty.channel.nio.NioEventLoop.run(NioEventLoop.Java:442)\r\n\tat io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.Java:884)\r\n\tat Java.lang.Thread.run(Thread.Java:748)\r\n\tSuppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: \nAssembly trace from producer [reactor.core.publisher.MonoFlatMap] :\n\treactor.core.publisher.Mono.flatMap(Mono.Java:2454)\n\torg.springframework.web.reactive.DispatcherHandler.handle(DispatcherHandler.Java:151)\n\torg.springframework.web.server.handler.DefaultWebFilterChain.lambda$filter$0(DefaultWebFilterChain.Java:122)\n\treactor.core.publisher.MonoDefer.subscribe(MonoDefer.Java:44)\n\treactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.Java:150)\n\treactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.Java:121)\n\treactor.core.publisher.Operators$MonoSubscriber.complete(Operators.Java:1476)\n\treactor.core.publisher.MonoProcessor.onNext(MonoProcessor.Java:389)\n\treactor.core.publisher.Operators$ScalarSubscription.request(Operators.Java:2041)\n\treactor.core.publisher.MonoProcessor.onSubscribe(MonoProcessor.Java:399)\n\treactor.core.publisher.MonoJust.subscribe(MonoJust.Java:54)\n\treactor.core.publisher.Mono.subscribe(Mono.Java:3590)\n\treactor.core.publisher.MonoProcessor.add(MonoProcessor.Java:531)\n\treactor.core.publisher.MonoProcessor.subscribe(MonoProcessor.Java:444)\n\treactor.core.publisher.MonoMapFuseable.subscribe(MonoMapFuseable.Java:59)\n\treactor.core.publisher.MonoFlatMap.subscribe(MonoFlatMap.Java:60)\n\treactor.core.publisher.MonoDefer.subscribe(MonoDefer.Java:52)\n\treactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.Java:44)\n\treactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.Java:44)\n\treactor.core.publisher.MonoPeekTerminal.subscribe(MonoPeekTerminal.Java:61)\n\treactor.core.publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.Java:44)\n\treactor.core.publisher.Mono.subscribe(Mono.Java:3590)\n\treactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.drain(MonoIgnoreThen.Java:172)\n\treactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.Java:56)\n\treactor.core.publisher.MonoPeekFuseable.subscribe(MonoPeekFuseable.Java:70)\n\treactor.core.publisher.MonoPeekTerminal.subscribe(MonoPeekTerminal.Java:61)\n\treactor.netty.http.server.HttpServerHandle.onStateChange(HttpServerHandle.Java:64)\n\treactor.netty.tcp.TcpServerBind$ChildObserver.onStateChange(TcpServerBind.Java:226)\n\treactor.netty.http.server.HttpServerOperations.onInboundNext(HttpServerOperations.Java:431)\n\treactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.Java:141)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:362)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:348)\n\tio.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.Java:340)\n\treactor.netty.http.server.HttpTrafficHandler.channelRead(HttpTrafficHandler.Java:159)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:362)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:348)\n\tio.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.Java:340)\n\tio.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.Java:438)\n\tio.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.Java:310)\n\tio.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.Java:297)\n\tio.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.Java:413)\n\tio.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.Java:265)\n\tio.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.Java:253)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:362)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:348)\n\tio.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.Java:340)\n\tio.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.Java:1434)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:362)\n\tio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:348)\n\tio.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.Java:965)\n\tio.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.Java:163)\n\tio.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.Java:628)\n\tio.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.Java:563)\n\tio.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.Java:480)\n\tio.netty.channel.nio.NioEventLoop.run(NioEventLoop.Java:442)\n\tio.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.Java:884)\nError has been observed by the following operator(s):\n\t|_\tMono.flatMap ⇢ org.springframework.web.reactive.DispatcherHandler.handle(DispatcherHandler.Java:151)\n\t|_\tMono.flatMap ⇢ org.springframework.web.reactive.DispatcherHandler.handle(DispatcherHandler.Java:152)\n\t|_\tMono.defer ⇢ org.springframework.web.server.handler.DefaultWebFilterChain.filter(DefaultWebFilterChain.Java:119)\n\t|_\tMono.flatMap ⇢ org.springframework.web.filter.reactive.HiddenHttpMethodFilter.filter(HiddenHttpMethodFilter.Java:90)\n\t|_\tMono.defer ⇢ org.springframework.web.server.handler.DefaultWebFilterChain.filter(DefaultWebFilterChain.Java:119)\n\r\n"
}
誰かが解決策を持っているなら、私はそれを感謝します
たぶん、コンバーターメソッド(およびconvertXmlToJson)を変更して、Mono<String>
ではなくString
を取るようにします。
次に、次のようなことを行うことができます。
Mono<String> response = requestString.flatMap(s -> this.convertFormatService.convertXmlToJson(s));
そこにはもっとクリーンアップができるかもしれないと思いますが、うまくいけば、これであなたはもっと近づくことができます。