Add symbol processor for configuration metadata - #51375
Open
salatmaster wants to merge 3 commits into
Open
Conversation
salatmaster
force-pushed
the
gh-28046-ksp-configuration-processor
branch
from
August 12, 2026 14:07
ae9a47e to
60d3b03
Compare
Add spring-boot-configuration-symbol-processor, a Kotlin Symbol Processing (KSP) processor that writes the configuration metadata of Kotlin types. It reuses the metadata model of the annotation processor, so the generated META-INF/spring-configuration-metadata.json is identical in format, and it lets a Kotlin project generate its metadata without kapt. The processor supports constructor binding and JavaBean binding, nested groups, @ConfigurationProperties on a method, actuator endpoints, descriptions taken from KDoc, deprecations, and the merging of META-INF/additional-spring-configuration-metadata.json. A type annotated with @ConfigurationPropertiesSource is described in a file of its own. Kotlin types are reported using their JVM names, so that a List<String> property is described as java.util.List<java.lang.String> as it is when the annotation processor runs. See spring-projectsgh-28046 Signed-off-by: Areg Iazychian <abstractcoderx@gmail.com>
Add the symbol processor to spring-boot-dependencies so that a project can declare it without having to specify its version. See spring-projectsgh-28046 Signed-off-by: Areg Iazychian <abstractcoderx@gmail.com>
Describe how to apply the symbol processor, the types that it supports, how to contribute additional metadata, and its limitations. Note that a module has to apply either the annotation processor or the symbol processor, as both write the same metadata file. See spring-projectsgh-28046 Signed-off-by: Areg Iazychian <abstractcoderx@gmail.com>
salatmaster
force-pushed
the
gh-28046-ksp-configuration-processor
branch
from
August 12, 2026 14:09
60d3b03 to
86bbb93
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds
spring-boot-configuration-symbol-processor, a KSP processor that generates configuration metadata for Kotlin sources, as an alternative to running the annotation processor through kapt. It reuses the metadata model of the existing annotation processor, so the generatedMETA-INF/spring-configuration-metadata.jsonis identical in format.Besides removing the need for kapt, it fixes metadata that kapt currently loses. For a data class with Kotlin defaults:
kapt generates a stub with two constructors, the annotation processor can no longer deduce the bind constructor, and no properties end up in the metadata at all — only the group. The symbol processor describes both properties. KDoc on constructor parameters (
@property) is picked up as well, which kapt drops.Supported: constructor and JavaBean binding,
@DefaultValue,@Name, nested groups,@NestedConfigurationProperty,@ConfigurationPropertieson a method, actuator endpoints, deprecations, KDoc descriptions, merging ofadditional-spring-configuration-metadata.json, and@ConfigurationPropertiesSource.Known limitations, all covered in the new appendix section:
@DefaultValuestill works.Tests drive the processor through the KSP2 API directly, so there is no third-party test dependency. The processor is compiled against
symbol-processing-api2.3.0 and declares it ascompileOnly, so the KSP version stays under the user's control.I'm aware this is marked as pending design work, so please treat it as a concrete proposal rather than a finished feature — happy to rework it if you'd rather see a different shape, such as an abstraction shared with the annotation processor.
See gh-28046