Open tmalinakis-vng opened 1 year ago
Going through the code, providing the following bean seems to restore the previous behaviour:
@Singleton
class JacksonSqlJsonValueMapper(
private val jacksonDatabindMapper: JacksonDatabindMapper
) : SqlJsonValueMapper {
override fun getJsonMapper(): JsonMapper {
return jacksonDatabindMapper
}
}
Still not sure if it's wise to rely on classes marked as Internal though.
There is another workaround, if that's ok with your project. Excluding micronaut serde jackson If using gradle
configurations.all {
exclude group: "io.micronaut.serde", module: "micronaut-serde-jackson"
}
and then make sure jackson databind is imported
runtime("io.micronaut:micronaut-jackson-databind")
// or implementation
then SqlJsonValueMapper
and SqlJsonColumnReader
will have JacksonDatabindMapper
as default JsonMapper
and adding this singleton is not needed.
@graemerocher Do we support this case in Micronaut Serialization?
Documentation for configuring serde dependency in Micronaut 4: https://micronaut.io/2023/02/27/micronaut-framework-4-0-and-micronaut-jackson-databind-transitive-dependency/
Expected Behavior
Fields annotated with DataType.JSON should continue to be serializable and deserializable. The following should work as it used to work in Micronaut 3.x:
Actual Behaviour
Getting a SerDe exception:
I've followed the instructions on adding the dependencies for updating to Micronaut 4.x. I've also tried annotating the Kotlin classes with
@Serdeable
but then I'm hitting a "No Default constructor exists" exception which seems to be a limitation of Micronaut Serialization.Is there a way to opt out from Micronaut Serialization back to plain Jackson?
Thanks
Steps To Reproduce
No response
Environment Information
Example Application
No response
Version
4.0.0