In our team, we agreed that we are gonna use all of the configurations as a code (let's Say AppConfiguration class) i.e :
@Value("${spring.datasource.url:jdbc:postgresql://localhost:5432/postgres}");
private String jdbcUrl;
and later use them to configure beans with this value:
@Bean
@Primary
@ConfigurationProperties(prefix = "spring.datasource.configuration")
public DataSource teamDataSource() {
return dataSourceProperties().initializeDataSourceBuilder().build();
}
@Bean
@Primary
public DataSourceProperties telemetryControlServiceDataSourceProperties() {
DataSourceProperties dataSourceProperties = new DataSourceProperties();
dataSourceProperties.setUrl(appConfig.getJdbcUrl());
....
return dataSourceProperties;
}
My Question: As configuration properties rise, I can't put anything in application.properties files per our agreement, and I have to search for pojos for @ConfigurationProperties which I could not find sometimes. Is there a general/universal way for exposing all kinds of configuration properties from applications.properties? I.e I'm able to find some of the actuator properties, but most of them I cannot:
management.endpoints.web.base-path=/debug
management.endpoints.web.exposure.include=*
management.endpoints.web.exposure.exclude=env,beans
management.endpoint.health.show-details=always
management.endpoint.metrics.enabled=true
management.endpoint.prometheus.enabled=true
management.endpoint.loggers.enabled=true