When I have following class defined in project
@ConfigurationProperties(DUBBO_PREFIX)
public class DubboConfigurationProperties {
@NestedConfigurationProperty
private MetricsConfig metrics = new MetricsConfig();
public MetricsConfig getMetrics() {
return metrics;
}
public void setMetrics(MetricsConfig metrics) {
this.metrics = metrics;
}
}
public class MetricsConfig {
private AggregationConfig aggregation;
public AggregationConfig getAggregation() {
return aggregation;
}
public void setAggregation(AggregationConfig aggregation) {
this.aggregation = aggregation;
}
}
public class AggregationConfig {
private Boolean enabled;
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
}
The spring-boot-configuration-processor can only generate metadata for MetricsConfig but not AggregationConfig
Like this
Can spring-boot-configuration-processor generate metadata for AggregationConfig? by the way, this module should not include dependency 'spring-boot', so I cannot use @NestedConfigurationProperty
Comment From: snicoll
Sorry, but no. The annotation processor is based on the contract that members are annotated according to the doc. You don't necessarily have to map third party classes. You can create a configuration properties structure in your Spring Boot module and map to it rather. This is the recommended approach as the annotation processor will have the source model of your class then and will be able to extract the default values and the javadoc on the field.
Comment From: wilkinsona
You can create a configuration properties structure in your Spring Boot module and map to it
Spring Boot's PropertyMapper
can be useful for this.