@Test public void testRestTemplate() { when(elasticSearchProperties.getUrls()).thenReturn("localhost:8000"); when(elasticSearchProperties.getConfig()).thenReturn(config); val elasticsearchRestTemplate = elasticSearchConfig.elasticsearchTemplate(); assertNotNull(elasticsearchRestTemplate); }
@Bean public ElasticsearchRestTemplate elasticsearchTemplate() { return new ElasticsearchRestTemplate(client()); }
ElasticsearchConfig { @Bean public ElasticsearchRestTemplate elasticsearchTemplate() { return new ElasticsearchRestTemplate(client()); } }
ElasticsearchConfig { @Bean public ElasticsearchRestTemplate elasticsearchTemplate() { return new ElasticsearchRestTemplate(client()); }  }
ElasticsearchConfig { @Bean public ElasticsearchRestTemplate elasticsearchTemplate() { return new ElasticsearchRestTemplate(client()); }  @Bean ElasticsearchRestTemplate elasticsearchTemplate(); @Bean(destroyMethod = "close") RestHighLevelClient client(); }
ElasticsearchConfig { @Bean public ElasticsearchRestTemplate elasticsearchTemplate() { return new ElasticsearchRestTemplate(client()); }  @Bean ElasticsearchRestTemplate elasticsearchTemplate(); @Bean(destroyMethod = "close") RestHighLevelClient client();  }