Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 74c8b79801 | |||
| 4f3c17be68 | |||
| 59530ce036 | |||
| b7c983e39e |
Vendored
+9
-64
@@ -12,10 +12,11 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage("test: baseline (jdk8)") {
|
stage("test: baseline (jdk17)") {
|
||||||
when {
|
when {
|
||||||
|
beforeAgent(true)
|
||||||
anyOf {
|
anyOf {
|
||||||
branch 'main'
|
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP")
|
||||||
not { triggeredBy 'UpstreamCause' }
|
not { triggeredBy 'UpstreamCause' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,7 +33,7 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
|
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
|
||||||
docker.image('adoptopenjdk/openjdk8:latest').inside('-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home') {
|
docker.image('openjdk:17-bullseye').inside('-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home') {
|
||||||
sh "docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW}"
|
sh "docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW}"
|
||||||
sh 'PROFILE=none ci/verify.sh'
|
sh 'PROFILE=none ci/verify.sh'
|
||||||
sh "ci/clean.sh"
|
sh "ci/clean.sh"
|
||||||
@@ -42,68 +43,11 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage("Test other configurations") {
|
|
||||||
when {
|
|
||||||
allOf {
|
|
||||||
branch 'main'
|
|
||||||
not { triggeredBy 'UpstreamCause' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
parallel {
|
|
||||||
stage("test: baseline (jdk11)") {
|
|
||||||
agent {
|
|
||||||
label 'data'
|
|
||||||
}
|
|
||||||
options { timeout(time: 30, unit: 'MINUTES') }
|
|
||||||
|
|
||||||
environment {
|
|
||||||
DOCKER_HUB = credentials('hub.docker.com-springbuildmaster')
|
|
||||||
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
|
|
||||||
}
|
|
||||||
|
|
||||||
steps {
|
|
||||||
script {
|
|
||||||
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
|
|
||||||
docker.image('adoptopenjdk/openjdk11:latest').inside('-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home') {
|
|
||||||
sh "docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW}"
|
|
||||||
sh 'PROFILE=java11 ci/verify.sh'
|
|
||||||
sh "ci/clean.sh"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage("test: baseline (jdk17)") {
|
|
||||||
agent {
|
|
||||||
label 'data'
|
|
||||||
}
|
|
||||||
options { timeout(time: 30, unit: 'MINUTES') }
|
|
||||||
|
|
||||||
environment {
|
|
||||||
DOCKER_HUB = credentials('hub.docker.com-springbuildmaster')
|
|
||||||
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
|
|
||||||
}
|
|
||||||
|
|
||||||
steps {
|
|
||||||
script {
|
|
||||||
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
|
|
||||||
docker.image('openjdk:17-bullseye').inside('-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home') {
|
|
||||||
sh "docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW}"
|
|
||||||
sh 'PROFILE=java11 ci/verify.sh'
|
|
||||||
sh "ci/clean.sh"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Release to artifactory') {
|
stage('Release to artifactory') {
|
||||||
when {
|
when {
|
||||||
|
beforeAgent(true)
|
||||||
anyOf {
|
anyOf {
|
||||||
branch 'main'
|
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP")
|
||||||
not { triggeredBy 'UpstreamCause' }
|
not { triggeredBy 'UpstreamCause' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,7 +63,7 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
|
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
|
||||||
docker.image('adoptopenjdk/openjdk8:latest').inside('-v $HOME:/tmp/jenkins-home') {
|
docker.image('openjdk:17-bullseye').inside('-v $HOME:/tmp/jenkins-home') {
|
||||||
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch-non-root ' +
|
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch-non-root ' +
|
||||||
'-Dartifactory.server=https://repo.spring.io ' +
|
'-Dartifactory.server=https://repo.spring.io ' +
|
||||||
"-Dartifactory.username=${ARTIFACTORY_USR} " +
|
"-Dartifactory.username=${ARTIFACTORY_USR} " +
|
||||||
@@ -133,6 +77,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Publish documentation') {
|
stage('Publish documentation') {
|
||||||
when {
|
when {
|
||||||
branch 'main'
|
branch 'main'
|
||||||
@@ -149,7 +94,7 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
|
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
|
||||||
docker.image('adoptopenjdk/openjdk8:latest').inside('-v $HOME:/tmp/jenkins-home') {
|
docker.image('openjdk:17-bullseye').inside('-v $HOME:/tmp/jenkins-home') {
|
||||||
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,distribute -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch-non-root ' +
|
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,distribute -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch-non-root ' +
|
||||||
'-Dartifactory.server=https://repo.spring.io ' +
|
'-Dartifactory.server=https://repo.spring.io ' +
|
||||||
"-Dartifactory.username=${ARTIFACTORY_USR} " +
|
"-Dartifactory.username=${ARTIFACTORY_USR} " +
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-elasticsearch</artifactId>
|
<artifactId>spring-data-elasticsearch</artifactId>
|
||||||
<version>4.4.0-SNAPSHOT</version>
|
<version>5.0.0-M1</version>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.data.build</groupId>
|
<groupId>org.springframework.data.build</groupId>
|
||||||
<artifactId>spring-data-parent</artifactId>
|
<artifactId>spring-data-parent</artifactId>
|
||||||
<version>2.7.0-SNAPSHOT</version>
|
<version>3.0.0-M1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<name>Spring Data Elasticsearch</name>
|
<name>Spring Data Elasticsearch</name>
|
||||||
@@ -22,7 +21,7 @@
|
|||||||
<elasticsearch>7.16.2</elasticsearch>
|
<elasticsearch>7.16.2</elasticsearch>
|
||||||
<log4j>2.17.0</log4j>
|
<log4j>2.17.0</log4j>
|
||||||
<netty>4.1.65.Final</netty>
|
<netty>4.1.65.Final</netty>
|
||||||
<springdata.commons>2.7.0-SNAPSHOT</springdata.commons>
|
<springdata.commons>3.0.0-M1</springdata.commons>
|
||||||
<testcontainers>1.16.2</testcontainers>
|
<testcontainers>1.16.2</testcontainers>
|
||||||
<blockhound-junit>1.0.6.RELEASE</blockhound-junit>
|
<blockhound-junit>1.0.6.RELEASE</blockhound-junit>
|
||||||
<java-module-name>spring.data.elasticsearch</java-module-name>
|
<java-module-name>spring.data.elasticsearch</java-module-name>
|
||||||
@@ -175,23 +174,40 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.enterprise</groupId>
|
<groupId>jakarta.enterprise</groupId>
|
||||||
<artifactId>cdi-api</artifactId>
|
<artifactId>jakarta.enterprise.cdi-api</artifactId>
|
||||||
<version>${cdi}</version>
|
<version>${cdi}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.annotation</groupId>
|
<groupId>jakarta.annotation</groupId>
|
||||||
<artifactId>javax.annotation-api</artifactId>
|
<artifactId>jakarta.annotation-api</artifactId>
|
||||||
<version>${javax-annotation-api}</version>
|
<version>${jakarta-annotation-api}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.openwebbeans</groupId>
|
<groupId>org.apache.openwebbeans</groupId>
|
||||||
<artifactId>openwebbeans-se</artifactId>
|
<artifactId>openwebbeans-se</artifactId>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
<version>${webbeans}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.openwebbeans</groupId>
|
||||||
|
<artifactId>openwebbeans-spi</artifactId>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
<version>${webbeans}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.openwebbeans</groupId>
|
||||||
|
<artifactId>openwebbeans-impl</artifactId>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
<version>${webbeans}</version>
|
<version>${webbeans}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -454,8 +470,8 @@
|
|||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spring-libs-snapshot</id>
|
<id>spring-libs-milestone</id>
|
||||||
<url>https://repo.spring.io/libs-snapshot</url>
|
<url>https://repo.spring.io/libs-milestone</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ public interface ClientConfiguration {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link ClientConfiguration} instance configured to localhost.
|
* Creates a new {@link ClientConfiguration} instance configured to localhost.
|
||||||
* <p/>
|
|
||||||
*
|
*
|
||||||
* <pre class="code">
|
* <pre class="code">
|
||||||
* // "localhost:9200"
|
* // "localhost:9200"
|
||||||
@@ -70,7 +69,6 @@ public interface ClientConfiguration {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link ClientConfiguration} instance configured to a single host given {@code hostAndPort}.
|
* Creates a new {@link ClientConfiguration} instance configured to a single host given {@code hostAndPort}.
|
||||||
* <p/>
|
|
||||||
* For example given the endpoint http://localhost:9200
|
* For example given the endpoint http://localhost:9200
|
||||||
*
|
*
|
||||||
* <pre class="code">
|
* <pre class="code">
|
||||||
@@ -85,7 +83,6 @@ public interface ClientConfiguration {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link ClientConfiguration} instance configured to a single host given {@link InetSocketAddress}.
|
* Creates a new {@link ClientConfiguration} instance configured to a single host given {@link InetSocketAddress}.
|
||||||
* <p/>
|
|
||||||
* For example given the endpoint http://localhost:9200
|
* For example given the endpoint http://localhost:9200
|
||||||
*
|
*
|
||||||
* <pre class="code">
|
* <pre class="code">
|
||||||
|
|||||||
+1
-2
@@ -28,8 +28,7 @@ import org.springframework.web.reactive.function.client.WebClient;
|
|||||||
/**
|
/**
|
||||||
* Provider for {@link WebClient}s using a pre-configured {@code scheme}. This class returns {@link WebClient} for a
|
* Provider for {@link WebClient}s using a pre-configured {@code scheme}. This class returns {@link WebClient} for a
|
||||||
* specific {@link InetSocketAddress endpoint} and encapsulates common configuration aspects of {@link WebClient} so
|
* specific {@link InetSocketAddress endpoint} and encapsulates common configuration aspects of {@link WebClient} so
|
||||||
* that code using {@link WebClient} is not required to apply further configuration to the actual client.
|
* that code using {@link WebClient} is not required to apply further configuration to the actual client. <br/>
|
||||||
* <p/>
|
|
||||||
* Client instances are typically cached allowing reuse of pooled connections if configured on the
|
* Client instances are typically cached allowing reuse of pooled connections if configured on the
|
||||||
* {@link ClientHttpConnector}.
|
* {@link ClientHttpConnector}.
|
||||||
*
|
*
|
||||||
|
|||||||
-1
@@ -148,7 +148,6 @@ public abstract class AbstractElasticsearchTemplate implements ElasticsearchOper
|
|||||||
/**
|
/**
|
||||||
* Set the {@link EntityCallbacks} instance to use when invoking {@link EntityCallbacks callbacks} like the
|
* Set the {@link EntityCallbacks} instance to use when invoking {@link EntityCallbacks callbacks} like the
|
||||||
* {@link org.springframework.data.elasticsearch.core.event.BeforeConvertCallback}.
|
* {@link org.springframework.data.elasticsearch.core.event.BeforeConvertCallback}.
|
||||||
* <p />
|
|
||||||
* Overrides potentially existing {@link EntityCallbacks}.
|
* Overrides potentially existing {@link EntityCallbacks}.
|
||||||
*
|
*
|
||||||
* @param entityCallbacks must not be {@literal null}.
|
* @param entityCallbacks must not be {@literal null}.
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class Range<T> {
|
|||||||
* @param <T>
|
* @param <T>
|
||||||
* @param value must not be {@literal null}.
|
* @param value must not be {@literal null}.
|
||||||
* @return
|
* @return
|
||||||
* @see Range#closed(T, T)
|
* @see Range#closed(Object, Object)
|
||||||
*/
|
*/
|
||||||
public static <T> Range<T> just(T value) {
|
public static <T> Range<T> just(T value) {
|
||||||
return Range.closed(value, value);
|
return Range.closed(value, value);
|
||||||
@@ -231,8 +231,8 @@ public class Range<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Value object representing a boundary. A boundary can either be {@link #unbounded() unbounded}, {@link #inclusive(T)
|
* Value object representing a boundary. A boundary can either be {@link #unbounded() unbounded}, {@link #inclusive(Object)}
|
||||||
* including its value} or {@link #exclusive(T) its value}.
|
* including its value} or {@link #exclusive(Object)} its value}.
|
||||||
*/
|
*/
|
||||||
public static final class Bound<T> {
|
public static final class Bound<T> {
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -211,7 +211,7 @@ public class ReactiveElasticsearchTemplate implements ReactiveElasticsearchOpera
|
|||||||
/**
|
/**
|
||||||
* Set the {@link ReactiveEntityCallbacks} instance to use when invoking {@link ReactiveEntityCallbacks callbacks}
|
* Set the {@link ReactiveEntityCallbacks} instance to use when invoking {@link ReactiveEntityCallbacks callbacks}
|
||||||
* like the {@link ReactiveBeforeConvertCallback}.
|
* like the {@link ReactiveBeforeConvertCallback}.
|
||||||
* <p />
|
* <br/>
|
||||||
* Overrides potentially existing {@link ReactiveEntityCallbacks}.
|
* Overrides potentially existing {@link ReactiveEntityCallbacks}.
|
||||||
*
|
*
|
||||||
* @param entityCallbacks must not be {@literal null}.
|
* @param entityCallbacks must not be {@literal null}.
|
||||||
|
|||||||
-3
@@ -127,7 +127,6 @@ public interface ReactiveSearchOperations {
|
|||||||
* @param <T>
|
* @param <T>
|
||||||
* @param query must not be {@literal null}.
|
* @param query must not be {@literal null}.
|
||||||
* @param entityType must not be {@literal null}.
|
* @param entityType must not be {@literal null}.
|
||||||
* @param <T>
|
|
||||||
* @return a {@link Mono} emitting matching entities in a {@link SearchHits}.
|
* @return a {@link Mono} emitting matching entities in a {@link SearchHits}.
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
@@ -142,7 +141,6 @@ public interface ReactiveSearchOperations {
|
|||||||
* @param query must not be {@literal null}.
|
* @param query must not be {@literal null}.
|
||||||
* @param entityType must not be {@literal null}.
|
* @param entityType must not be {@literal null}.
|
||||||
* @param resultType the projection result type.
|
* @param resultType the projection result type.
|
||||||
* @param <T>
|
|
||||||
* @return a {@link Mono} emitting matching entities in a {@link SearchHits}.
|
* @return a {@link Mono} emitting matching entities in a {@link SearchHits}.
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
@@ -155,7 +153,6 @@ public interface ReactiveSearchOperations {
|
|||||||
* @param query must not be {@literal null}.
|
* @param query must not be {@literal null}.
|
||||||
* @param entityType must not be {@literal null}.
|
* @param entityType must not be {@literal null}.
|
||||||
* @param index the target index, must not be {@literal null}
|
* @param index the target index, must not be {@literal null}
|
||||||
* @param <T>
|
|
||||||
* @return a {@link Mono} emitting matching entities in a {@link SearchHits}.
|
* @return a {@link Mono} emitting matching entities in a {@link SearchHits}.
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -205,7 +205,6 @@ public interface SearchOperations {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the given {@link Query} against elasticsearch and return result as {@link SearchHitsIterator}.
|
* Executes the given {@link Query} against elasticsearch and return result as {@link SearchHitsIterator}.
|
||||||
* <p>
|
|
||||||
*
|
*
|
||||||
* @param <T> element return type
|
* @param <T> element return type
|
||||||
* @param query the query to execute
|
* @param query the query to execute
|
||||||
@@ -218,7 +217,6 @@ public interface SearchOperations {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the given {@link Query} against elasticsearch and return result as {@link SearchHitsIterator}.
|
* Executes the given {@link Query} against elasticsearch and return result as {@link SearchHitsIterator}.
|
||||||
* <p>
|
|
||||||
*
|
*
|
||||||
* @param <T> element return type
|
* @param <T> element return type
|
||||||
* @param query the query to execute
|
* @param query the query to execute
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ import org.springframework.data.elasticsearch.core.convert.GeoConverters;
|
|||||||
import org.springframework.data.elasticsearch.core.document.Document;
|
import org.springframework.data.elasticsearch.core.document.Document;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface definition for structures defined in <a href="https://geojson.org/>GeoJSON</a> format. copied from Spring
|
* Interface definition for structures defined in <a href="https://geojson.org">GeoJSON</a>
|
||||||
|
* format. copied from Spring
|
||||||
* Data Mongodb
|
* Data Mongodb
|
||||||
*
|
*
|
||||||
* @author Christoph Strobl
|
* @author Christoph Strobl
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ public class MappingBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isNestedOrObjectProperty) {
|
if (isNestedOrObjectProperty) {
|
||||||
Iterator<? extends TypeInformation<?>> iterator = property.getPersistentEntityTypes().iterator();
|
Iterator<? extends TypeInformation<?>> iterator = property.getPersistentEntityTypeInformation().iterator();
|
||||||
ElasticsearchPersistentEntity<?> persistentEntity = iterator.hasNext()
|
ElasticsearchPersistentEntity<?> persistentEntity = iterator.hasNext()
|
||||||
? elasticsearchConverter.getMappingContext().getPersistentEntity(iterator.next())
|
? elasticsearchConverter.getMappingContext().getPersistentEntity(iterator.next())
|
||||||
: null;
|
: null;
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public interface Query {
|
|||||||
float getMinScore();
|
float getMinScore();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if scores will be computed and tracked, regardless of whether sorting on a field. Defaults to <tt>false</tt>.
|
* Get if scores will be computed and tracked, regardless of whether sorting on a field. Defaults to <em>false</em>.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import org.springframework.lang.Nullable;
|
|||||||
* @author Mohsin Husen
|
* @author Mohsin Husen
|
||||||
* @author Peter-Josef Meisch
|
* @author Peter-Josef Meisch
|
||||||
* @author Farid Faoudi
|
* @author Farid Faoudi
|
||||||
* @see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html>docs</a>
|
* @see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html">docs</a>
|
||||||
*/
|
*/
|
||||||
public class UpdateQuery {
|
public class UpdateQuery {
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -19,9 +19,9 @@ import java.lang.annotation.Annotation;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.enterprise.context.spi.CreationalContext;
|
import jakarta.enterprise.context.spi.CreationalContext;
|
||||||
import javax.enterprise.inject.spi.Bean;
|
import jakarta.enterprise.inject.spi.Bean;
|
||||||
import javax.enterprise.inject.spi.BeanManager;
|
import jakarta.enterprise.inject.spi.BeanManager;
|
||||||
|
|
||||||
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
||||||
import org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactory;
|
import org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactory;
|
||||||
@@ -49,12 +49,12 @@ public class ElasticsearchRepositoryBean<T> extends CdiRepositoryBean<T> {
|
|||||||
* @param repositoryType must not be {@literal null}.
|
* @param repositoryType must not be {@literal null}.
|
||||||
* @param beanManager must not be {@literal null}.
|
* @param beanManager must not be {@literal null}.
|
||||||
* @param detector detector for the custom {@link org.springframework.data.repository.Repository} implementations
|
* @param detector detector for the custom {@link org.springframework.data.repository.Repository} implementations
|
||||||
* {@link CustomRepositoryImplementationDetector}, can be {@literal null}.
|
* {@link CustomRepositoryImplementationDetector}, can be {@link Optional#empty()}.
|
||||||
*/
|
*/
|
||||||
public ElasticsearchRepositoryBean(Bean<ElasticsearchOperations> operations, Set<Annotation> qualifiers,
|
public ElasticsearchRepositoryBean(Bean<ElasticsearchOperations> operations, Set<Annotation> qualifiers,
|
||||||
Class<T> repositoryType, BeanManager beanManager, CustomRepositoryImplementationDetector detector) {
|
Class<T> repositoryType, BeanManager beanManager, Optional<CustomRepositoryImplementationDetector> detector) {
|
||||||
|
|
||||||
super(qualifiers, repositoryType, beanManager, Optional.of(detector));
|
super(qualifiers, repositoryType, beanManager, detector);
|
||||||
|
|
||||||
Assert.notNull(operations, "Cannot create repository with 'null' for ElasticsearchOperations.");
|
Assert.notNull(operations, "Cannot create repository with 'null' for ElasticsearchOperations.");
|
||||||
this.elasticsearchOperationsBean = operations;
|
this.elasticsearchOperationsBean = operations;
|
||||||
@@ -62,7 +62,7 @@ public class ElasticsearchRepositoryBean<T> extends CdiRepositoryBean<T> {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.springframework.data.repository.cdi.CdiRepositoryBean#create(javax.enterprise.context.spi.CreationalContext, java.lang.Class)
|
* @see org.springframework.data.repository.cdi.CdiRepositoryBean#create(jakarta.enterprise.context.spi.CreationalContext, java.lang.Class)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected T create(CreationalContext<T> creationalContext, Class<T> repositoryType) {
|
protected T create(CreationalContext<T> creationalContext, Class<T> repositoryType) {
|
||||||
|
|||||||
+32
-13
@@ -18,17 +18,21 @@ package org.springframework.data.elasticsearch.repository.cdi;
|
|||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.enterprise.event.Observes;
|
import jakarta.enterprise.event.Observes;
|
||||||
import javax.enterprise.inject.UnsatisfiedResolutionException;
|
import jakarta.enterprise.inject.UnsatisfiedResolutionException;
|
||||||
import javax.enterprise.inject.spi.AfterBeanDiscovery;
|
import jakarta.enterprise.inject.spi.AfterBeanDiscovery;
|
||||||
import javax.enterprise.inject.spi.Bean;
|
import jakarta.enterprise.inject.spi.Bean;
|
||||||
import javax.enterprise.inject.spi.BeanManager;
|
import jakarta.enterprise.inject.spi.BeanManager;
|
||||||
import javax.enterprise.inject.spi.ProcessBean;
|
import jakarta.enterprise.inject.spi.ProcessBean;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
||||||
import org.springframework.data.repository.cdi.CdiRepositoryBean;
|
import org.springframework.data.repository.cdi.CdiRepositoryBean;
|
||||||
import org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport;
|
import org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport;
|
||||||
@@ -43,14 +47,24 @@ import org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport;
|
|||||||
*/
|
*/
|
||||||
public class ElasticsearchRepositoryExtension extends CdiRepositoryExtensionSupport {
|
public class ElasticsearchRepositoryExtension extends CdiRepositoryExtensionSupport {
|
||||||
|
|
||||||
|
private static final Log LOGGER = LogFactory.getLog(ElasticsearchRepositoryExtension.class);
|
||||||
|
|
||||||
private final Map<Set<Annotation>, Bean<ElasticsearchOperations>> elasticsearchOperationsMap = new HashMap<>();
|
private final Map<Set<Annotation>, Bean<ElasticsearchOperations>> elasticsearchOperationsMap = new HashMap<>();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
<T> void processBean(@Observes ProcessBean<T> processBean) {
|
<T> void processBean(@Observes ProcessBean<T> processBean) {
|
||||||
|
|
||||||
Bean<T> bean = processBean.getBean();
|
Bean<T> bean = processBean.getBean();
|
||||||
|
|
||||||
for (Type type : bean.getTypes()) {
|
for (Type type : bean.getTypes()) {
|
||||||
if (type instanceof Class<?> && ElasticsearchOperations.class.isAssignableFrom((Class<?>) type)) {
|
if (type instanceof Class<?> && ElasticsearchOperations.class.isAssignableFrom((Class<?>) type)) {
|
||||||
elasticsearchOperationsMap.put(bean.getQualifiers(), ((Bean<ElasticsearchOperations>) bean));
|
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debug(String.format("Discovered %s with qualifiers %s.", ElasticsearchOperations.class.getName(),
|
||||||
|
bean.getQualifiers()));
|
||||||
|
}
|
||||||
|
|
||||||
|
elasticsearchOperationsMap.put(new HashSet<>(bean.getQualifiers()), ((Bean<ElasticsearchOperations>) bean));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,22 +76,27 @@ public class ElasticsearchRepositoryExtension extends CdiRepositoryExtensionSupp
|
|||||||
Set<Annotation> qualifiers = entry.getValue();
|
Set<Annotation> qualifiers = entry.getValue();
|
||||||
|
|
||||||
CdiRepositoryBean<?> repositoryBean = createRepositoryBean(repositoryType, qualifiers, beanManager);
|
CdiRepositoryBean<?> repositoryBean = createRepositoryBean(repositoryType, qualifiers, beanManager);
|
||||||
afterBeanDiscovery.addBean(repositoryBean);
|
|
||||||
|
if (LOGGER.isInfoEnabled()) {
|
||||||
|
LOGGER.info(String.format("Registering bean for %s with qualifiers %s.", repositoryType.getName(), qualifiers));
|
||||||
|
}
|
||||||
|
|
||||||
registerBean(repositoryBean);
|
registerBean(repositoryBean);
|
||||||
|
afterBeanDiscovery.addBean(repositoryBean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> CdiRepositoryBean<T> createRepositoryBean(Class<T> repositoryType, Set<Annotation> qualifiers,
|
private <T> CdiRepositoryBean<T> createRepositoryBean(Class<T> repositoryType, Set<Annotation> qualifiers,
|
||||||
BeanManager beanManager) {
|
BeanManager beanManager) {
|
||||||
|
|
||||||
if (!this.elasticsearchOperationsMap.containsKey(qualifiers)) {
|
Bean<ElasticsearchOperations> elasticsearchOperations = this.elasticsearchOperationsMap.get(qualifiers);
|
||||||
|
|
||||||
|
if (elasticsearchOperations == null) {
|
||||||
throw new UnsatisfiedResolutionException(String.format("Unable to resolve a bean for '%s' with qualifiers %s.",
|
throw new UnsatisfiedResolutionException(String.format("Unable to resolve a bean for '%s' with qualifiers %s.",
|
||||||
ElasticsearchOperations.class.getName(), qualifiers));
|
ElasticsearchOperations.class.getName(), qualifiers));
|
||||||
}
|
}
|
||||||
|
|
||||||
Bean<ElasticsearchOperations> elasticsearchOperationsBean = this.elasticsearchOperationsMap.get(qualifiers);
|
return new ElasticsearchRepositoryBean<>(elasticsearchOperations, qualifiers, repositoryType, beanManager,
|
||||||
|
Optional.of(getCustomImplementationDetector()));
|
||||||
return new ElasticsearchRepositoryBean<>(elasticsearchOperationsBean, qualifiers, repositoryType, beanManager,
|
|
||||||
getCustomImplementationDetector());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -54,10 +54,10 @@ public class ConvertingParameterAccessor implements ElasticsearchParameterAccess
|
|||||||
return delegate.getSort();
|
return delegate.getSort();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public Optional<Class<?>> getDynamicProjection() {
|
// public Optional<Class<?>> getDynamicProjection() {
|
||||||
return delegate.getDynamicProjection();
|
// return delegate.getDynamicProjection();
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> findDynamicProjection() {
|
public Class<?> findDynamicProjection() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Spring Data Elasticsearch 4.3 GA (2021.1.0)
|
Spring Data Elasticsearch 5.0 M1 (2022.0.0)
|
||||||
Copyright (c) [2013-2021] Pivotal Software, Inc.
|
Copyright (c) [2013-2021] Pivotal Software, Inc.
|
||||||
|
|
||||||
This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
||||||
@@ -30,5 +30,6 @@ conditions of the subcomponent's license, as noted in the LICENSE file.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.repositories.cdi;
|
package org.springframework.data.elasticsearch.repositories.cdi;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import jakarta.inject.Inject;
|
||||||
|
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
|
|||||||
+4
-7
@@ -24,8 +24,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import javax.enterprise.inject.se.SeContainer;
|
import jakarta.enterprise.inject.se.SeContainer;
|
||||||
import javax.enterprise.inject.se.SeContainerInitializer;
|
import jakarta.enterprise.inject.se.SeContainerInitializer;
|
||||||
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
@@ -49,7 +49,7 @@ import org.springframework.lang.Nullable;
|
|||||||
@IntegrationTest
|
@IntegrationTest
|
||||||
public class CdiRepositoryTests {
|
public class CdiRepositoryTests {
|
||||||
|
|
||||||
@Nullable private static SeContainer container;
|
@SuppressWarnings("NotNullFieldNotInitialized") private static SeContainer container;
|
||||||
|
|
||||||
// @Nullable private static CdiTestContainer cdiContainer;
|
// @Nullable private static CdiTestContainer cdiContainer;
|
||||||
private CdiProductRepository repository;
|
private CdiProductRepository repository;
|
||||||
@@ -67,10 +67,7 @@ public class CdiRepositoryTests {
|
|||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void shutdown() throws Exception {
|
public static void shutdown() throws Exception {
|
||||||
|
container.close();
|
||||||
if (container != null) {
|
|
||||||
container.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
|
|||||||
+3
-3
@@ -15,9 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.repositories.cdi;
|
package org.springframework.data.elasticsearch.repositories.cdi;
|
||||||
|
|
||||||
import javax.annotation.PreDestroy;
|
import jakarta.annotation.PreDestroy;
|
||||||
import javax.enterprise.context.ApplicationScoped;
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
import javax.enterprise.inject.Produces;
|
import jakarta.enterprise.inject.Produces;
|
||||||
|
|
||||||
import org.elasticsearch.client.RestHighLevelClient;
|
import org.elasticsearch.client.RestHighLevelClient;
|
||||||
import org.springframework.data.elasticsearch.client.ClientConfiguration;
|
import org.springframework.data.elasticsearch.client.ClientConfiguration;
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ import java.lang.annotation.Retention;
|
|||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
import javax.inject.Qualifier;
|
import jakarta.inject.Qualifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mark Paluch
|
* @author Mark Paluch
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import java.lang.annotation.Retention;
|
|||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
import javax.inject.Qualifier;
|
import jakarta.inject.Qualifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mark Paluch
|
* @author Mark Paluch
|
||||||
|
|||||||
-9
@@ -91,15 +91,6 @@ class StubParameterAccessor implements ElasticsearchParameterAccessor {
|
|||||||
return this.values;
|
return this.values;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
* @see org.springframework.data.repository.query.ParameterAccessor#getDynamicProjection()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Optional<Class<?>> getDynamicProjection() {
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.springframework.data.repository.query.ParameterAccessor#findDynamicProjection()
|
* @see org.springframework.data.repository.query.ParameterAccessor#findDynamicProjection()
|
||||||
|
|||||||
Reference in New Issue
Block a user