You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I follow the tutorial available on the PKL doc https://pkl-lang.org/spring/current/usage.html, and it is specified to use either the spring @ConfigurationPropertiesScan annotation in order to detect configuration files, I cannot launch my application. I have to use the annotation @EnableConfigurationProperties({AppConfig.class,AppConfig.Server.class}) with all the necessary annotation classes, which is annoying if there are a lot of configuration classes
Here is my build.grade for the version
plugins {
id 'java'
id 'org.springframework.boot' version '4.0.6'
id 'io.spring.dependency-management' version '1.1.7'
id "org.pkl-lang" version "0.31.1"
}
group ='univ.lille'
version ='0.0.1-SNAPSHOT'
description ='test-spring-plk-2'
java {
toolchain {
languageVersion =JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-webmvc'
testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation "org.pkl-lang:pkl-spring:0.18.0"
}
tasks.named('test') {
useJUnitPlatform()
}
pkl {
javaCodeGenerators {
configClasses {
generateGetters.set(true)
generateSpringBootConfig.set(true)
sourceModules.set(files("src/main/resources/AppConfig.pkl"))
}
}
}
I ran the documented sample against main (a1baaec) with Spring Boot 4.0.6, Pkl codegen 0.31.1, and Java 17. It started and bound the Pkl configuration with the default scan. I reproduced a startup error for a missing AppConfig.Server bean when the generated classes were outside the application's scan package.
If your generated classes are in a separate package, try pointing the scan at AppConfig on your application class.
Activity
Vcode2407 commentedon Nov 15, 2026
I ran the documented sample against
main(a1baaec) with Spring Boot 4.0.6, Pkl codegen 0.31.1, and Java 17. It started and bound the Pkl configuration with the default scan. I reproduced a startup error for a missingAppConfig.Serverbean when the generated classes were outside the application's scan package.If your generated classes are in a separate package, try pointing the scan at
AppConfigon your application class.That let the same app start and bind the generated configuration in my test.