Add support for customizing spring boot ConfigurationProperties (#1897)

This adds an option which allows users to control exactly how
`@ConfigurationProperties` annotations are attached to classes.

This helps when:

* Spring Boot users don't have a single root class, but multiple
  classes that are injected in disparate places
* Pkl's module structure doesn't match the resulting `.properties`
  layout
This commit is contained in:
Daniel Chao authored and GitHub committed 2026-10-08 20:42:59 +00:00
1 parent f973fd6717
commit 88a50d167e
15 files changed
+294 -10

No files matched your search

@@ -36,6 +36,21 @@ Example: `generateSpringBootConfig = true` +
Whether to generate config classes for use with Spring Boot.
====
.springBootConfigurationProperties: MapProperty<String, String>
[%collapsible]
====
Default: `[:]` +
Example: `springBootConfigurationProperties = ["my.mod": "", "my.mod#Server": "server"]` +
Explicitly configures which generated classes receive the Spring Boot `@ConfigurationProperties` annotation, and with what prefix.
Only applies if `generateSpringBootConfig` is `true`.
The key is the Pkl class name (for example, `my.mod` for a module class, or `my.mod#Server` for a class within a module), and the value is the annotation's prefix.
An empty value generates a bare `@ConfigurationProperties` annotation.
If this property is empty, the annotations are inferred from the structure of the input modules.
If this property is set, no annotations are inferred, and only the specified classes are annotated.
====
.implementSerializable: Property<Boolean>
[%collapsible]
====