ClobValueCodec implements ValueCodec { @Override @SneakyThrows public Object decode(Object data) { if (data instanceof Clob) { Clob clobData = ((Clob) data); data = clobData.getSubString(1, (int) clobData.length()); } else if (FeatureUtils.r2dbcIsAlive()) { Mono mono = null; if (data instanceof io.r2dbc.spi.Clob) { mono = Flux.from(((io.r2dbc.spi.Clob) data).stream()) .collect(Collectors.joining()); } if (mono != null) { return mono.toFuture().get(10, TimeUnit.SECONDS); } }else if(data instanceof ByteBuffer){ ByteBuffer byteBuffer = ((ByteBuffer) data); byte[] bytes = new byte[byteBuffer.remaining()]; byteBuffer.get(bytes); return new String(bytes, StandardCharsets.UTF_8); } return data; }  @Override @SneakyThrows Object encode(Object value); @Override @SneakyThrows Object decode(Object data); static final ClobValueCodec INSTANCE; }
@Test public void testR2dbc() { ClobValueCodec codec = new ClobValueCodec(); assertEquals(codec.decode(Clob.from(Mono.just("test"))),"test"); }