Skip to content

ConfigurationPropertiesScan #50

@ScyAge

Description

@ScyAge

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"))
        }
    }
}

Here is the structure of my project:

Image

Thanks for the future help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions