Spring-boot 无法识别为第三方库编写的 Koltin 序列化程序

问题描述

我使用的外部类:https://github.com/arrow-kt/arrow/blob/5e0db6b7aaeb1ac99ecbfff74f03cce28e234391/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Either.kt#L725

Arrow.Core 库中的密封类。

这是我的自定义序列化程序

@Serializer(forClass = arrow.core.Either::class)
object EitherSerializer : KSerializer<Either<ErrorResponse,SuccessResponse>> {

通过这个设置,我希望 Springboot 使用 Kotlin 序列化程序而不是 jackson2。 Kotlin 运行时可以识别自己的类 Kotlin 序列化程序(使用 @Serializable),并且它使用 KotlinSerializationjsonHttpMessageConverter,但在上述情况下,(使用 @Serialzer)调用认的 Jackson HTTP 消息转换器。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)