优化elasticsearch 关闭逻辑
This commit is contained in:
parent
7d116896fa
commit
396ef0142d
|
|
@ -52,8 +52,8 @@ public class ElasticSearchConfiguration {
|
|||
return new ElasticRestClient(client, client);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RestHighLevelClient elasticsearchRestHighLevelClient(ElasticRestClient client) {
|
||||
@Bean(destroyMethod = "close")
|
||||
public RestHighLevelClient restHighLevelClient(ElasticRestClient client) {
|
||||
return client.getWriteClient();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import org.jetlinks.community.elastic.search.index.ElasticSearchIndexManager;
|
|||
import org.jetlinks.community.elastic.search.utils.ElasticSearchConverter;
|
||||
import org.jetlinks.community.elastic.search.utils.ReactorActionListener;
|
||||
import org.reactivestreams.Publisher;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.stereotype.Service;
|
||||
import reactor.core.publisher.BufferOverflowStrategy;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
|
@ -47,6 +48,7 @@ import java.util.stream.Collectors;
|
|||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
@DependsOn("restHighLevelClient")
|
||||
public class DefaultElasticSearchService implements ElasticSearchService {
|
||||
|
||||
private final ElasticRestClient restClient;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import org.hswebframework.web.loggin.aop.EnableAccessLogger;
|
|||
import org.hswebframework.web.logging.events.AccessLoggerAfterEvent;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.elasticsearch.rest.RestClientAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
|
|
@ -18,7 +19,8 @@ import javax.annotation.PostConstruct;
|
|||
|
||||
|
||||
@SpringBootApplication(scanBasePackages = "org.jetlinks.community", exclude = {
|
||||
DataSourceAutoConfiguration.class
|
||||
DataSourceAutoConfiguration.class,
|
||||
RestClientAutoConfiguration.class
|
||||
})
|
||||
@EnableCaching
|
||||
@EnableEasyormRepository("org.jetlinks.community.**.entity")
|
||||
|
|
|
|||
Loading…
Reference in New Issue