The requested URL was not found on this server. 不管你信不信,反正我是没找到

springboot1.5.9支持elasticsearch的最高版本是多少?

Elasticsearch | 作者 renly | 发布于2019年11月08日 | 阅读数:184

springboot1.5.9支持elasticsearch的最高版本是多少?
已邀请:

Dm

赞同来自:

QQ截图20191210174249.png

 

yuechen323 - 80后IT男 - 这 placeHolder 挺好的

赞同来自:

都是自己写 configuration 的谁还用 springboot 的 starter 啊, 限制太多
 
    private final EsProperties properties;

    public EsConfiguration(EsProperties properties) {
        this.properties = properties;
    }


    @bean
    @ConditionalOnMissingBean
    public RestClientBuilder restClientBuilder() {
        HttpHost[] hosts = this.properties.getUris().stream().map(HttpHost::create)
                .toArray(HttpHost[]::new);
        RestClientBuilder builder = RestClient.builder(hosts);
        PropertyMapper map = PropertyMapper.get();
        map.from(this.properties::getUsername).whenHasText().to((username) -> {
            CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
            Credentials credentials = new UsernamePasswordCredentials(
                    this.properties.getUsername(), this.properties.getPassword());
            credentialsProvider.setCredentials(AuthScope.ANY, credentials);
            builder.setHttpClientConfigCallback((httpClientBuilder) -> httpClientBuilder
                    .setDefaultCredentialsProvider(credentialsProvider));
        });

        return builder;
    }

    @bean
    @ConditionalOnMissingBean
    public RestHighLevelClient restHighLevelClient(
            RestClientBuilder restClientBuilder) {
        return new RestHighLevelClient(restClientBuilder);
    }

要回复问题请先登录注册