-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Closed
Labels
status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by anothertype: bugA general bugA general bug
Description
Generation of metadata for configuration properties doesn't work work with immutable var Kotlin properties.
Module: spring-boot-configuration-processor
Version: 2.2.0.M4
Build system: Maven
Language: Kotlin
Related to: #8762
Property class:
@ConfigurationProperties(prefix = "spring.pulsar")
data class PulsarProperties(
val serviceUrl: String = "pulsar://localhost:6650",
val listenerThreads: Int = 1,
...
)
Maven plugin setup:
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<executions>
<execution>
<id>kapt</id>
<goals>
<goal>kapt</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/main/kotlin</sourceDir>
</sourceDirs>
<output></output>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>2.2.0.M4</version>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>
</execution>
</executions>
<configuration>
<args>
<arg>-Xjsr305=strict</arg>
</args>
<compilerPlugins>
<plugin>spring</plugin>
</compilerPlugins>
</configuration>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-allopen</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</plugin>
Generated spring-configuration.metadata.json:
{
"groups": [
{
"name": "spring.pulsar",
"type": "sample.config.PulsarProperties",
"sourceType": "sample.config.PulsarProperties"
}
],
"properties": [],
"hints": []
}
... so it's missing properties completely.
In case that property is specified outside of the constructor (lateinit var property - like before #8762 was implemented) then metadata is generated properly.
In documentation there're mentioned some features are not working with kapt but I do believe this should work (and in case of immutable props also with defaults).
maffelbaffel and T-bond
Metadata
Metadata
Assignees
Labels
status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by anothertype: bugA general bugA general bug