-
Notifications
You must be signed in to change notification settings - Fork 41.8k
Closed
Labels
status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by another
Description
Generating configuration metadata from @ConfigurationProperties items written in Kotlin doesn't work for defaultValue fields. It works fine for all the other fields. In java, it works fine for everything. Here is an example. Note that I'm using Spring Boot 2.0 and Gradle.
kapt 'org.springframework.boot:spring-boot-configuration-processor'
kapt {
arguments {
arg("org.springframework.boot.configurationprocessor.additionalMetadataLocations", "$projectDir/src/main/resources")
}
}
compileJava.dependsOn(processResources)
My @ConfigurationProperties file looks like this:
@Component
@ConfigurationProperties("flowr.epg")
class EpgProperties {
/** Whether or not schedules should be computed/refreshed on (re)start */
var refreshOnRestart = true
/** Number of threads used to store new images */
var nImagesUploadThreads = 10
}
The result looks like this:
{
"hints": [],
"groups": [
{
"sourceType": "com.taktik.flowr.epg.properties.EpgProperties",
"name": "flowr.epg",
"type": "com.taktik.flowr.epg.properties.EpgProperties"
}
],
"properties": [
{
"sourceType": "com.taktik.flowr.epg.properties.EpgProperties",
"defaultValue": false,
"name": "flowr.epg.refresh-on-restart",
"description": "Whether or not schedules should be computed\/refreshed on (re)start",
"type": "java.lang.Boolean"
},
{
"sourceType": "com.taktik.flowr.epg.properties.EpgProperties",
"defaultValue": 0,
"name": "flowr.epg.n-images-upload-threads",
"description": "Number of threads used to store new images",
"type": "java.lang.Integer"
}
}
Support for default values in Kotlin would be a really nice feature to have for my company.
Note: replicated from https://stackoverflow.com/questions/53636533/spring-boot-configurationproperties-metadata-generation-wrong-default-values
darioseidl, Purfakt, jbryson3, PedroAlvarado and hirakida
Metadata
Metadata
Assignees
Labels
status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by another