spring native 0.12.0 was supported spring-data-elasticsearch?
Sanshimemeda opened this issue · comments
I don't quite understand. Is there something which is not working?
I want to convert my jar project into a native project, which uses elasticsearch and uses @configuration to configure ElasticsearchRestTemplate
@configuration
public class RestClientConfig extends AbstractElasticsearchConfiguration {
/** Spring elasticsearch rest uris. */
@Value("${spring.elasticsearch.rest.uris:localhost:9200}")
private String uris;
@Override
@Bean
public RestHighLevelClient elasticsearchClient() {
if (!uris.contains(":")) {
uris += ":9200";
}
RestClientBuilder restClientBuilder = RestClient.builder(HttpHost.create(uris))
.setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder
.setKeepAliveStrategy((response, context) -> Duration.ofMinutes(5).toMillis()));
return new RestHighLevelClient(restClientBuilder);
}
@Bean("esRestTemplate")
@Primary
public ElasticsearchRestTemplate esRestTemplate() {
return new ElasticsearchRestTemplate(elasticsearchClient());
}
}
When I package my project with nativeCompile and run the native image, it prompts that the bean of elasticsearchTemplate cannot be found
APPLICATION FAILED TO START
Description:
Field realTimeSessionRepo in com.rank.tool.es.impl.RealTimeSessionRepositoryImpl required a bean named 'elasticsearchTemplate' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired
Action:
Consider defining a bean named 'elasticsearchTemplate' in your configuration.
Ah, thanks for the explanation. However:
Spring Native is now superseded by Spring Boot 3 official native support, see the related reference documentation for more details.
As a consequence, I am closing this issue, and recommend trying your use case with latest Spring Boot 3 version. If you still experience the issue reported here, please open an issue directly on the related Spring project (Spring Framework, Data, Security, Boot, Cloud, etc.) with a reproducer.
Thanks for your contribution on the experimental Spring Native project, we hope you will enjoy the official native support introduced by Spring Boot 3.
ok! thank you very much!