Skip to content

Commit

Permalink
Merge branch '3.0.x' into 3.1.x
Browse files Browse the repository at this point in the history
Closes gh-36700
  • Loading branch information
wilkinsona committed Aug 3, 2023
2 parents 12a2c61 + c6dc505 commit 664581e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,12 +17,15 @@
package org.springframework.boot.autoconfigure.elasticsearch;

import co.elastic.clients.elasticsearch.ElasticsearchClient;
import org.elasticsearch.client.RestClient;

import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchClientConfigurations.ElasticsearchClientConfiguration;
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchClientConfigurations.ElasticsearchTransportConfiguration;
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchClientConfigurations.JsonpMapperConfiguration;
import org.springframework.boot.autoconfigure.jsonb.JsonbAutoConfiguration;
import org.springframework.context.annotation.Import;

Expand All @@ -33,8 +36,10 @@
* @since 3.0.0
*/
@AutoConfiguration(after = { JsonbAutoConfiguration.class, ElasticsearchRestClientAutoConfiguration.class })
@ConditionalOnBean(RestClient.class)
@ConditionalOnClass(ElasticsearchClient.class)
@Import({ ElasticsearchTransportConfiguration.class, ElasticsearchClientConfiguration.class })
@Import({ JsonpMapperConfiguration.class, ElasticsearchTransportConfiguration.class,
ElasticsearchClientConfiguration.class })
public class ElasticsearchClientAutoConfiguration {

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
*/
class ElasticsearchClientConfigurations {

@Import({ JacksonJsonpMapperConfiguration.class, JsonbJsonpMapperConfiguration.class,
SimpleJsonpMapperConfiguration.class })
static class JsonpMapperConfiguration {

}

@ConditionalOnMissingBean(JsonpMapper.class)
@ConditionalOnClass(ObjectMapper.class)
@Configuration(proxyBeanMethods = false)
Expand Down Expand Up @@ -79,9 +85,6 @@ SimpleJsonpMapper simpleJsonpMapper() {

}

@Import({ JacksonJsonpMapperConfiguration.class, JsonbJsonpMapperConfiguration.class,
SimpleJsonpMapperConfiguration.class })
@ConditionalOnBean(RestClient.class)
@ConditionalOnMissingBean(ElasticsearchTransport.class)
static class ElasticsearchTransportConfiguration {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.springframework.boot.autoconfigure.elasticsearch;

import co.elastic.clients.transport.ElasticsearchTransport;
import org.elasticsearch.client.RestClient;
import reactor.core.publisher.Mono;

import org.springframework.boot.autoconfigure.AutoConfiguration;
Expand All @@ -37,9 +38,11 @@
* @since 3.0.0
*/
@AutoConfiguration(after = ElasticsearchClientAutoConfiguration.class)
@ConditionalOnBean(RestClient.class)
@ConditionalOnClass({ ReactiveElasticsearchClient.class, ElasticsearchTransport.class, Mono.class })
@EnableConfigurationProperties(ElasticsearchProperties.class)
@Import(ElasticsearchClientConfigurations.ElasticsearchTransportConfiguration.class)
@Import({ ElasticsearchClientConfigurations.JsonpMapperConfiguration.class,
ElasticsearchClientConfigurations.ElasticsearchTransportConfiguration.class })
public class ReactiveElasticsearchClientAutoConfiguration {

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ JsonpMapper customJsonpMapper() {
static class TransportConfiguration {

@Bean
ElasticsearchTransport customElasticsearchTransport() {
ElasticsearchTransport customElasticsearchTransport(JsonpMapper mapper) {
return mock(ElasticsearchTransport.class);
}

Expand Down

0 comments on commit 664581e

Please sign in to comment.