apple / apple/pkl-spring

ConfigurationPropertiesScan

Open
#50 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
52
Forks
10
PR merge metrics
No merged PRs in 30d

Description

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
```kt
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"))
}
}
}
```
Here is the structure of my project:

Image

Thanks for the future help.

Contributor guide

Open the contributing guide

Research direction

Start with the PKL Spring usage tutorial and the generated configuration from src/main/resources/AppConfig.pkl, then compare the ConfigurationPropertiesScan setup with the working EnableConfigurationProperties declarations in the report. Reproduce the launch failure using the supplied build.gradle configuration and determine what behavior should allow the application to start without listing every configuration class.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.