Closed as not planned
Closed as not planned
Description
The generated spring-configuration-metadata.json
does not generate description
when using @ConfigurationProperties with Java Record
@ConfigurationProperties(prefix = "web.cors.record")
public record CorsRecordConfiguration(
/**
* allowedOrigins description (record)
*/
List<String> allowedOrigins,
/**
* allowedMethods description (record)
*/
List<String> allowedMethods) {}
Generated metadata
{
"groups": [
{
"name": "web.cors.record",
"type": "com.bwgjoseph.springbootmvnstarter.CorsRecordConfiguration",
"sourceType": "com.bwgjoseph.springbootmvnstarter.CorsRecordConfiguration"
}
],
"properties": [
{
"name": "web.cors.record.allowed-methods",
"type": "java.util.List<java.lang.String>",
"sourceType": "com.bwgjoseph.springbootmvnstarter.CorsRecordConfiguration"
},
{
"name": "web.cors.record.allowed-origins",
"type": "java.util.List<java.lang.String>",
"sourceType": "com.bwgjoseph.springbootmvnstarter.CorsRecordConfiguration"
}
],
"hints": []
}
When not using with Java Record
, it actually works as expected
@ConfigurationProperties(prefix = "web.cors.class")
@ConstructorBinding // needed this to generate the description
public class CorsClassConfiguration {
/**
* allowedOrigins description (class)
*/
private final List<String> allowedOrigins;
/**
* allowedMethods description (class)
*/
private final List<String> allowedMethods;
public CorsClassConfiguration(List<String> allowedOrigins, List<String> allowedMethods) {
this.allowedOrigins = allowedOrigins;
this.allowedMethods = allowedMethods;
}
}
{
"groups": [
{
"name": "web.cors.class",
"type": "com.bwgjoseph.springbootmvnstarter.CorsClassConfiguration",
"sourceType": "com.bwgjoseph.springbootmvnstarter.CorsClassConfiguration"
}
],
"properties": [
{
"name": "web.cors.class.allowed-methods",
"type": "java.util.List<java.lang.String>",
"description": "allowedMethods description (class)",
"sourceType": "com.bwgjoseph.springbootmvnstarter.CorsClassConfiguration"
},
{
"name": "web.cors.class.allowed-origins",
"type": "java.util.List<java.lang.String>",
"description": "allowedOrigins description (class)",
"sourceType": "com.bwgjoseph.springbootmvnstarter.CorsClassConfiguration"
}
],
"hints": []
}
Adding @ConstructorBinding on Java Record
does not work either
spring-boot: 2.7.8