Skip to content

Commit cacdcb1

Browse files
committed
Create spring-boot-data-elasticsearch module
1 parent 3cf0dd2 commit cacdcb1

File tree

29 files changed

+127
-132
lines changed

29 files changed

+127
-132
lines changed

Diff for: settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ include "spring-boot-project:spring-boot-batch"
5353
include "spring-boot-project:spring-boot-cassandra"
5454
include "spring-boot-project:spring-boot-couchbase"
5555
include "spring-boot-project:spring-boot-data-cassandra"
56+
include "spring-boot-project:spring-boot-data-elasticsearch"
5657
include "spring-boot-project:spring-boot-data-jpa"
5758
include "spring-boot-project:spring-boot-data-ldap"
5859
include "spring-boot-project:spring-boot-data-mongodb"

Diff for: spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ dependencies {
2222
optional(project(":spring-boot-project:spring-boot-artemis"))
2323
optional(project(":spring-boot-project:spring-boot-couchbase"))
2424
optional(project(":spring-boot-project:spring-boot-data-cassandra"))
25+
optional(project(":spring-boot-project:spring-boot-data-elasticsearch"))
2526
optional(project(":spring-boot-project:spring-boot-data-jpa"))
2627
optional(project(":spring-boot-project:spring-boot-data-mongodb"))
27-
optional(project(":spring-boot-project:spring-boot-elasticsearch"))
2828
optional(project(":spring-boot-project:spring-boot-flyway"))
2929
optional(project(":spring-boot-project:spring-boot-hazelcast"))
3030
optional(project(":spring-boot-project:spring-boot-http"))

Diff for: spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/data/elasticsearch/ElasticsearchReactiveHealthContributorAutoConfigurationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.springframework.boot.actuate.data.elasticsearch.ElasticsearchReactiveHealthIndicator;
2424
import org.springframework.boot.actuate.elasticsearch.ElasticsearchRestClientHealthIndicator;
2525
import org.springframework.boot.autoconfigure.AutoConfigurations;
26-
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;
26+
import org.springframework.boot.data.elasticsearch.autoconfigure.ElasticsearchDataAutoConfiguration;
2727
import org.springframework.boot.elasticsearch.autoconfigure.ElasticsearchRestClientAutoConfiguration;
2828
import org.springframework.boot.elasticsearch.autoconfigure.ReactiveElasticsearchClientAutoConfiguration;
2929
import org.springframework.boot.test.context.runner.ApplicationContextRunner;

Diff for: spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebEndpointsAutoConfigurationIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.springframework.boot.actuate.health.HealthEndpointWebExtension;
2525
import org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension;
2626
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
27-
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;
2827
import org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration;
2928
import org.springframework.boot.autoconfigure.data.neo4j.Neo4jRepositoriesAutoConfiguration;
3029
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
@@ -33,6 +32,7 @@
3332
import org.springframework.boot.cassandra.autoconfigure.CassandraAutoConfiguration;
3433
import org.springframework.boot.context.annotation.UserConfigurations;
3534
import org.springframework.boot.data.cassandra.autoconfigure.CassandraDataAutoConfiguration;
35+
import org.springframework.boot.data.elasticsearch.autoconfigure.ElasticsearchDataAutoConfiguration;
3636
import org.springframework.boot.data.mongodb.autoconfigure.MongoDataAutoConfiguration;
3737
import org.springframework.boot.data.mongodb.autoconfigure.MongoReactiveDataAutoConfiguration;
3838
import org.springframework.boot.flyway.autoconfigure.FlywayAutoConfiguration;

Diff for: spring-boot-project/spring-boot-autoconfigure-all/build.gradle

-14
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ dependencies {
3434
dockerTestImplementation("org.mockito:mockito-core")
3535
dockerTestImplementation("org.springframework:spring-test")
3636
dockerTestImplementation("org.testcontainers:couchbase")
37-
dockerTestImplementation("org.testcontainers:elasticsearch")
3837
dockerTestImplementation("org.testcontainers:junit-jupiter")
3938
dockerTestImplementation("org.testcontainers:mongodb")
4039
dockerTestImplementation("org.testcontainers:neo4j")
@@ -45,7 +44,6 @@ dependencies {
4544
optional(project(":spring-boot-project:spring-boot-couchbase"))
4645
optional(project(":spring-boot-project:spring-boot-data-jpa"))
4746
optional(project(":spring-boot-project:spring-boot-data-mongodb"))
48-
optional(project(":spring-boot-project:spring-boot-elasticsearch"))
4947
optional(project(":spring-boot-project:spring-boot-flyway"))
5048
optional(project(":spring-boot-project:spring-boot-h2"))
5149
optional(project(":spring-boot-project:spring-boot-hazelcast"))
@@ -63,9 +61,6 @@ dependencies {
6361
optional(project(":spring-boot-project:spring-boot-tx"))
6462
optional(project(":spring-boot-project:spring-boot-validation"))
6563
optional(project(":spring-boot-project:spring-boot-webmvc"))
66-
optional("co.elastic.clients:elasticsearch-java") {
67-
exclude group: "commons-logging", module: "commons-logging"
68-
}
6964
optional("com.fasterxml.jackson.core:jackson-databind")
7065
optional("com.fasterxml.jackson.dataformat:jackson-dataformat-cbor")
7166
optional("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
@@ -120,12 +115,6 @@ dependencies {
120115
classifier = 'jakarta'
121116
}
122117
}
123-
optional("org.elasticsearch.client:elasticsearch-rest-client") {
124-
exclude group: "commons-logging", module: "commons-logging"
125-
}
126-
optional("org.elasticsearch.client:elasticsearch-rest-client-sniffer") {
127-
exclude group: "commons-logging", module: "commons-logging"
128-
}
129118
optional("org.glassfish.jersey.containers:jersey-container-servlet-core")
130119
optional("org.glassfish.jersey.containers:jersey-container-servlet")
131120
optional("org.glassfish.jersey.core:jersey-server")
@@ -171,9 +160,6 @@ dependencies {
171160
exclude group: "org.jboss.spec.javax.transaction", module: "jboss-transaction-api_1.2_spec"
172161
}
173162
optional("org.springframework.data:spring-data-rest-webmvc")
174-
optional("org.springframework.data:spring-data-elasticsearch") {
175-
exclude group: "org.elasticsearch.client", module: "transport"
176-
}
177163
optional("org.springframework.data:spring-data-jdbc")
178164
optional("org.springframework.data:spring-data-mongodb")
179165
optional("org.springframework.data:spring-data-neo4j")

Diff for: spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/additional-spring-configuration-metadata.json

-30
Original file line numberDiff line numberDiff line change
@@ -32,36 +32,6 @@
3232
"description": "Type of Couchbase repositories to enable.",
3333
"defaultValue": "auto"
3434
},
35-
{
36-
"name": "spring.data.elasticsearch.cluster-name",
37-
"type": "java.lang.String",
38-
"description": "Elasticsearch cluster name.",
39-
"deprecation": {
40-
"level": "error"
41-
}
42-
},
43-
{
44-
"name": "spring.data.elasticsearch.cluster-nodes",
45-
"type": "java.lang.String",
46-
"description": "Comma-separated list of cluster node addresses.",
47-
"deprecation": {
48-
"level": "error"
49-
}
50-
},
51-
{
52-
"name": "spring.data.elasticsearch.properties",
53-
"type": "java.util.Map<java.lang.String,java.lang.String>",
54-
"description": "Additional properties used to configure the client.",
55-
"deprecation": {
56-
"level": "error"
57-
}
58-
},
59-
{
60-
"name": "spring.data.elasticsearch.repositories.enabled",
61-
"type": "java.lang.Boolean",
62-
"description": "Whether to enable Elasticsearch repositories.",
63-
"defaultValue": true
64-
},
6535
{
6636
"name": "spring.data.jdbc.repositories.enabled",
6737
"type": "java.lang.Boolean",

Diff for: spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ org.springframework.boot.autoconfigure.data.couchbase.CouchbaseDataAutoConfigura
55
org.springframework.boot.autoconfigure.data.couchbase.CouchbaseReactiveDataAutoConfiguration
66
org.springframework.boot.autoconfigure.data.couchbase.CouchbaseReactiveRepositoriesAutoConfiguration
77
org.springframework.boot.autoconfigure.data.couchbase.CouchbaseRepositoriesAutoConfiguration
8-
org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration
9-
org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration
10-
org.springframework.boot.autoconfigure.data.elasticsearch.ReactiveElasticsearchRepositoriesAutoConfiguration
118
org.springframework.boot.autoconfigure.data.jdbc.JdbcRepositoriesAutoConfiguration
129
org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration
1310
org.springframework.boot.autoconfigure.data.neo4j.Neo4jReactiveDataAutoConfiguration

Diff for: spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/data/alt/elasticsearch/CityReactiveElasticsearchDbRepository.java

-24
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
plugins {
2+
id "java-library"
3+
id "org.springframework.boot.auto-configuration"
4+
id "org.springframework.boot.configuration-properties"
5+
id "org.springframework.boot.deployed"
6+
id "org.springframework.boot.docker-test"
7+
id "org.springframework.boot.optional-dependencies"
8+
}
9+
10+
description = "Spring Boot New Project"
11+
12+
dependencies {
13+
api(project(":spring-boot-project:spring-boot-elasticsearch"))
14+
api("org.springframework.data:spring-data-elasticsearch")
15+
16+
dockerTestImplementation(project(":spring-boot-project:spring-boot-test"))
17+
dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support-docker"))
18+
dockerTestImplementation(testFixtures(project(":spring-boot-project:spring-boot-autoconfigure")))
19+
dockerTestImplementation("ch.qos.logback:logback-classic")
20+
dockerTestImplementation("org.junit.jupiter:junit-jupiter")
21+
dockerTestImplementation("org.testcontainers:elasticsearch")
22+
dockerTestImplementation("org.testcontainers:junit-jupiter")
23+
24+
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
25+
optional("io.projectreactor:reactor-core")
26+
27+
testImplementation(project(":spring-boot-project:spring-boot-test"))
28+
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
29+
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-autoconfigure")))
30+
31+
testRuntimeOnly("ch.qos.logback:logback-classic")
32+
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.data.elasticsearch;
17+
package org.springframework.boot.data.elasticsearch.autoconfigure;
1818

1919
import org.junit.jupiter.api.Test;
2020
import org.testcontainers.elasticsearch.ElasticsearchContainer;
@@ -23,10 +23,9 @@
2323

2424
import org.springframework.boot.autoconfigure.AutoConfigurations;
2525
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
26-
import org.springframework.boot.autoconfigure.data.alt.elasticsearch.CityElasticsearchDbRepository;
27-
import org.springframework.boot.autoconfigure.data.elasticsearch.city.City;
28-
import org.springframework.boot.autoconfigure.data.elasticsearch.city.CityRepository;
29-
import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage;
26+
import org.springframework.boot.data.elasticsearch.domain.city.City;
27+
import org.springframework.boot.data.elasticsearch.domain.city.CityRepository;
28+
import org.springframework.boot.data.elasticsearch.domain.empty.EmptyDataPackage;
3029
import org.springframework.boot.elasticsearch.autoconfigure.ElasticsearchClientAutoConfiguration;
3130
import org.springframework.boot.elasticsearch.autoconfigure.ElasticsearchRestClientAutoConfiguration;
3231
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
@@ -74,7 +73,7 @@ void testNoRepositoryConfiguration() {
7473
@Test
7574
void doesNotTriggerDefaultRepositoryDetectionIfCustomized() {
7675
this.contextRunner.withUserConfiguration(CustomizedConfiguration.class)
77-
.run((context) -> assertThat(context).hasSingleBean(CityElasticsearchDbRepository.class));
76+
.run((context) -> assertThat(context).hasSingleBean(CityRepository.class));
7877
}
7978

8079
@Test
@@ -96,14 +95,14 @@ static class EmptyConfiguration {
9695
}
9796

9897
@Configuration(proxyBeanMethods = false)
99-
@TestAutoConfigurationPackage(ElasticsearchRepositoriesAutoConfigurationTests.class)
100-
@EnableElasticsearchRepositories(basePackageClasses = CityElasticsearchDbRepository.class)
98+
@TestAutoConfigurationPackage(City.class)
99+
@EnableElasticsearchRepositories(basePackageClasses = CityRepository.class)
101100
static class CustomizedConfiguration {
102101

103102
}
104103

105104
@Configuration(proxyBeanMethods = false)
106-
@TestAutoConfigurationPackage(ElasticsearchRepositoriesAutoConfigurationTests.class)
105+
@TestAutoConfigurationPackage(City.class)
107106
@EnableElasticsearchRepositories
108107
@EnableElasticsearchAuditing
109108
static class AuditingConfiguration {
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.data.elasticsearch;
17+
package org.springframework.boot.data.elasticsearch.autoconfigure;
1818

1919
import org.junit.jupiter.api.Test;
2020
import org.testcontainers.elasticsearch.ElasticsearchContainer;
@@ -24,10 +24,9 @@
2424

2525
import org.springframework.boot.autoconfigure.AutoConfigurations;
2626
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
27-
import org.springframework.boot.autoconfigure.data.alt.elasticsearch.CityReactiveElasticsearchDbRepository;
28-
import org.springframework.boot.autoconfigure.data.elasticsearch.city.City;
29-
import org.springframework.boot.autoconfigure.data.elasticsearch.city.ReactiveCityRepository;
30-
import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage;
27+
import org.springframework.boot.data.elasticsearch.domain.city.City;
28+
import org.springframework.boot.data.elasticsearch.domain.city.ReactiveCityRepository;
29+
import org.springframework.boot.data.elasticsearch.domain.empty.EmptyDataPackage;
3130
import org.springframework.boot.elasticsearch.autoconfigure.ElasticsearchClientAutoConfiguration;
3231
import org.springframework.boot.elasticsearch.autoconfigure.ElasticsearchRestClientAutoConfiguration;
3332
import org.springframework.boot.elasticsearch.autoconfigure.ReactiveElasticsearchClientAutoConfiguration;
@@ -88,7 +87,7 @@ void testNoRepositoryConfiguration() {
8887
@Test
8988
void doesNotTriggerDefaultRepositoryDetectionIfCustomized() {
9089
this.contextRunner.withUserConfiguration(CustomizedConfiguration.class)
91-
.run((context) -> assertThat(context).hasSingleBean(CityReactiveElasticsearchDbRepository.class));
90+
.run((context) -> assertThat(context).hasSingleBean(ReactiveCityRepository.class));
9291
}
9392

9493
@Test
@@ -110,14 +109,14 @@ static class EmptyConfiguration {
110109
}
111110

112111
@Configuration(proxyBeanMethods = false)
113-
@TestAutoConfigurationPackage(ReactiveElasticsearchRepositoriesAutoConfigurationTests.class)
114-
@EnableReactiveElasticsearchRepositories(basePackageClasses = CityReactiveElasticsearchDbRepository.class)
112+
@TestAutoConfigurationPackage(City.class)
113+
@EnableReactiveElasticsearchRepositories(basePackageClasses = ReactiveCityRepository.class)
115114
static class CustomizedConfiguration {
116115

117116
}
118117

119118
@Configuration(proxyBeanMethods = false)
120-
@TestAutoConfigurationPackage(ElasticsearchRepositoriesAutoConfigurationTests.class)
119+
@TestAutoConfigurationPackage(City.class)
121120
@EnableReactiveElasticsearchRepositories
122121
@EnableElasticsearchAuditing
123122
static class AuditingConfiguration {
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,11 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.data.alt.elasticsearch;
17+
package org.springframework.boot.data.elasticsearch.domain.empty;
1818

19-
import org.springframework.boot.autoconfigure.data.elasticsearch.city.City;
20-
import org.springframework.data.repository.Repository;
21-
22-
public interface CityElasticsearchDbRepository extends Repository<City, Long> {
19+
public class EmptyDataPackage {
2320

2421
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.data.elasticsearch;
17+
package org.springframework.boot.data.elasticsearch.autoconfigure;
1818

1919
import org.springframework.boot.autoconfigure.AutoConfiguration;
2020
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -31,7 +31,7 @@
3131
* @author Brian Clozel
3232
* @author Artur Konczak
3333
* @author Mohsin Husen
34-
* @since 1.1.0
34+
* @since 4.0.0
3535
* @see EnableElasticsearchRepositories
3636
* @see EnableReactiveElasticsearchRepositories
3737
*/
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.data.elasticsearch;
17+
package org.springframework.boot.data.elasticsearch.autoconfigure;
1818

1919
import java.util.Collections;
2020

Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.data.elasticsearch;
17+
package org.springframework.boot.data.elasticsearch.autoconfigure;
1818

1919
import org.springframework.boot.autoconfigure.AutoConfiguration;
2020
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -32,7 +32,7 @@
3232
*
3333
* @author Artur Konczak
3434
* @author Mohsin Husen
35-
* @since 1.1.0
35+
* @since 4.0.0
3636
* @see EnableElasticsearchRepositories
3737
*/
3838
@AutoConfiguration

0 commit comments

Comments
 (0)