Thank you, Allard for your feedback.
Here I am spesifically referring to Spring and Spring boot configuration. Can we have a configurer instead (https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-developing-auto-configuration.html) of using autowiring? I am no spring boot expert but used it in the past and works very well. In the spring boot project, you create a configurer which allows developers using the libraries to customise things as they need.
Following is a basic example
In the xxx-spring-boot-autoconfigure project, you create an interface which developers can implement.
public interface XxxConfigurationCustomizer {
void customize(XxxBuilder builder);
}
Then you pick it up in the auto-configuration and use it
@Configuration
@ConditionalOnClass({ Xxx.class })
public class XxxAutoConfiguration {
@Autowired(required = false)
private List configurationCustomizers;
@Bean
@ConditionalOnMissingBean
public XxxBuilder xxxBuilder(/* Pass other services here /) {
final DefaultXxx.Builder builder = DefaultXxx.builder();
/ Initilaise it with the defaults */
return builder;
}
@Bean
@ConditionalOnMissingBean
public Xxx xxx(final XxxBuilder builder) {
customize(builder);
return builder.build();
}
/* Loop thourgh each customizer */
private XxxBuilder customize(final XxxBuilder builder) {
if (this.configurationCustomizers != null) {
for (final XxxConfigurationCustomizer customizer : this.configurationCustomizers) {
customizer.customize(builder);
}
}
return builder;
}
}
I do not know if this fits your scenario or not, but we can take it off-line if you like to discuss it further.