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

@@ -22,6 +22,24 @@ Default: (not set) +
Flag that indicates to generate config classes for use with Spring Boot.
====
.--spring-boot-configuration-properties
[%collapsible]
====
Default: (none) +
Example: `my.mod#Server=server` +
Explicitly configures which generated classes receive the Spring Boot `@ConfigurationProperties` annotation, and with what prefix.
Only applies if `--generate-spring-boot` is set.
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 option is omitted, the annotations are inferred from the structure of the input modules.
If this option is set, no annotations are inferred, and only the specified classes are annotated.
Repeat this option to define multiple mappings.
Values must be valid Spring Boot configuration properties prefixes.
====
.--implement-serializable
[%collapsible]
====