Enhancement

inspired by org.springframework.boot.autoconfigure.jdbc.DataSourceProperties#initializeDataSourceBuilder, would it also make sense to expose a similar mechanism for other components? Specifically in this case elasticsearch?

Comment From: mhalbritter

I'm not sure I understand.

This is the code which creates the RestClient in org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientConfigurations.RestClientConfiguration#elasticsearchRestClient:

@Bean
RestClient elasticsearchRestClient(RestClientBuilder restClientBuilder) {
  return restClientBuilder.build();
}

What is hard about that?

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: riba2101

ow, sry missed this,

lets say you want to provide lib that writes to elastic - so not as a project user repo based approach, but in a lib. there you cant rly use the rest client builder since the props would be located somewhere else?

the approaches between modules vary.

so one way would be to create a builder on top/or a method that takes props as a param and then can spit out a rest client .

but this still does not help with all the bootstrapping around the rest client(template etc)

Comment From: philwebb

I'm afraid this request doesn't make any sense to me. Perhaps you can provide an example application that shows exactly what you're trying to do, why it's difficult with the current design and any changes that you think we could make.

In the meantime, I'm going to close this issue because there's nothing immediately obvious that we can change.

Comment From: riba2101

the whole point is that org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientConfigurations.RestClientBuilderConfiguration#elasticsearchRestClientBuilder takes the host list only from one place.

so if you have for example 2 separate clusters - one needs to c/p half of the code there to point it somewhere else...

my proposal is to provide an easy(er) way to create a RestClientBuilder with all dependant classes - not to c/p the whole bean method.