Version

Spring Framework 6.x

Depscription

There are a lot of hint configurations ( reflect-config.json ) in the project that need to be merged in the same file, and I hope the merged JSON format remains the same.

Text before formatting:

{
    "condition":
    {
        "typeReachable": "com.github.benmanes.caffeine.cache.BBHeader$ReadAndWriteCounterRef"
    },
    "name": "com.github.benmanes.caffeine.cache.BBHeader$ReadAndWriteCounterRef",
    "fields":
    [
        {
            "name": "writeCounter"
        }
    ]
}

I want the formatted text to be : ( Generated by native-image-agent )

{
  "condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BBHeader$ReadAndWriteCounterRef"},
  "name":"com.github.benmanes.caffeine.cache.BBHeader$ReadAndWriteCounterRef",
  "fields":[{"name":"writeCounter"}]
}

I checked the source code of Spring-Framework and found that it seems that FileNativeConfigurationWriter can be used to format and write to the local file ( reflect-config.json ) , but how do I deserialize the JSON text ( Text before formatting ) into a RuntimeHints object.

Or is there any other better solution? Thanks!

Comment From: bclozel

Those JSON configuration files are not designed by Spring, but are specified by the GraalVM project. You can find the schema files in their repository here. Spring Framework does not mean to offer public serialization/parsing/merging facilities for those files publicly, those classes are only meant for internal support.

Comment From: ruansheng8

Those JSON configuration files are not designed by Spring, but are specified by the GraalVM project. You can find the schema files in their repository here. Spring Framework does not mean to offer public serialization/parsing/merging facilities for those files publicly, those classes are only meant for internal support.

ok, thanks!