Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 74c8b79801 | |||
| 4f3c17be68 | |||
| 59530ce036 | |||
| b7c983e39e |
Vendored
+9
-64
@@ -12,10 +12,11 @@ pipeline {
|
||||
}
|
||||
|
||||
stages {
|
||||
stage("test: baseline (jdk8)") {
|
||||
stage("test: baseline (jdk17)") {
|
||||
when {
|
||||
beforeAgent(true)
|
||||
anyOf {
|
||||
branch 'main'
|
||||
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP")
|
||||
not { triggeredBy 'UpstreamCause' }
|
||||
}
|
||||
}
|
||||
@@ -32,7 +33,7 @@ pipeline {
|
||||
steps {
|
||||
script {
|
||||
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 'PROFILE=none ci/verify.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') {
|
||||
when {
|
||||
beforeAgent(true)
|
||||
anyOf {
|
||||
branch 'main'
|
||||
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP")
|
||||
not { triggeredBy 'UpstreamCause' }
|
||||
}
|
||||
}
|
||||
@@ -119,7 +63,7 @@ pipeline {
|
||||
steps {
|
||||
script {
|
||||
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 ' +
|
||||
'-Dartifactory.server=https://repo.spring.io ' +
|
||||
"-Dartifactory.username=${ARTIFACTORY_USR} " +
|
||||
@@ -133,6 +77,7 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Publish documentation') {
|
||||
when {
|
||||
branch 'main'
|
||||
@@ -149,7 +94,7 @@ pipeline {
|
||||
steps {
|
||||
script {
|
||||
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 ' +
|
||||
'-Dartifactory.server=https://repo.spring.io ' +
|
||||
"-Dartifactory.username=${ARTIFACTORY_USR} " +
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
<?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"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<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">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-elasticsearch</artifactId>
|
||||
<version>4.4.0-SNAPSHOT</version>
|
||||
<version>5.0.0-M1</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.data.build</groupId>
|
||||
<artifactId>spring-data-parent</artifactId>
|
||||
<version>2.7.0-SNAPSHOT</version>
|
||||
<version>3.0.0-M1</version>
|
||||
</parent>
|
||||
|
||||
<name>Spring Data Elasticsearch</name>
|
||||
@@ -22,7 +21,7 @@
|
||||
<elasticsearch>7.16.2</elasticsearch>
|
||||
<log4j>2.17.0</log4j>
|
||||
<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>
|
||||
<blockhound-junit>1.0.6.RELEASE</blockhound-junit>
|
||||
<java-module-name>spring.data.elasticsearch</java-module-name>
|
||||
@@ -175,23 +174,40 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.enterprise</groupId>
|
||||
<artifactId>cdi-api</artifactId>
|
||||
<groupId>jakarta.enterprise</groupId>
|
||||
<artifactId>jakarta.enterprise.cdi-api</artifactId>
|
||||
<version>${cdi}</version>
|
||||
<scope>provided</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>${javax-annotation-api}</version>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
<version>${jakarta-annotation-api}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.openwebbeans</groupId>
|
||||
<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>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
@@ -454,8 +470,8 @@
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-libs-snapshot</id>
|
||||
<url>https://repo.spring.io/libs-snapshot</url>
|
||||
<id>spring-libs-milestone</id>
|
||||
<url>https://repo.spring.io/libs-milestone</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
|
||||
@@ -54,7 +54,6 @@ public interface ClientConfiguration {
|
||||
|
||||
/**
|
||||
* Creates a new {@link ClientConfiguration} instance configured to localhost.
|
||||
* <p/>
|
||||
*
|
||||
* <pre class="code">
|
||||
* // "localhost:9200"
|
||||
@@ -70,7 +69,6 @@ public interface ClientConfiguration {
|
||||
|
||||
/**
|
||||
* Creates a new {@link ClientConfiguration} instance configured to a single host given {@code hostAndPort}.
|
||||
* <p/>
|
||||
* For example given the endpoint http://localhost:9200
|
||||
*
|
||||
* <pre class="code">
|
||||
@@ -85,7 +83,6 @@ public interface ClientConfiguration {
|
||||
|
||||
/**
|
||||
* Creates a new {@link ClientConfiguration} instance configured to a single host given {@link InetSocketAddress}.
|
||||
* <p/>
|
||||
* For example given the endpoint http://localhost:9200
|
||||
*
|
||||
* <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
|
||||
* 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.
|
||||
* <p/>
|
||||
* that code using {@link WebClient} is not required to apply further configuration to the actual client. <br/>
|
||||
* Client instances are typically cached allowing reuse of pooled connections if configured on the
|
||||
* {@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
|
||||
* {@link org.springframework.data.elasticsearch.core.event.BeforeConvertCallback}.
|
||||
* <p />
|
||||
* Overrides potentially existing {@link EntityCallbacks}.
|
||||
*
|
||||
* @param entityCallbacks must not be {@literal null}.
|
||||
|
||||
@@ -58,7 +58,7 @@ public class Range<T> {
|
||||
* @param <T>
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see Range#closed(T, T)
|
||||
* @see Range#closed(Object, Object)
|
||||
*/
|
||||
public static <T> Range<T> just(T 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)
|
||||
* including its value} or {@link #exclusive(T) its value}.
|
||||
* Value object representing a boundary. A boundary can either be {@link #unbounded() unbounded}, {@link #inclusive(Object)}
|
||||
* including its value} or {@link #exclusive(Object)} its value}.
|
||||
*/
|
||||
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}
|
||||
* like the {@link ReactiveBeforeConvertCallback}.
|
||||
* <p />
|
||||
* <br/>
|
||||
* Overrides potentially existing {@link ReactiveEntityCallbacks}.
|
||||
*
|
||||
* @param entityCallbacks must not be {@literal null}.
|
||||
|
||||
-3
@@ -127,7 +127,6 @@ public interface ReactiveSearchOperations {
|
||||
* @param <T>
|
||||
* @param query 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}.
|
||||
* @since 4.1
|
||||
*/
|
||||
@@ -142,7 +141,6 @@ public interface ReactiveSearchOperations {
|
||||
* @param query must not be {@literal null}.
|
||||
* @param entityType must not be {@literal null}.
|
||||
* @param resultType the projection result type.
|
||||
* @param <T>
|
||||
* @return a {@link Mono} emitting matching entities in a {@link SearchHits}.
|
||||
* @since 4.1
|
||||
*/
|
||||
@@ -155,7 +153,6 @@ public interface ReactiveSearchOperations {
|
||||
* @param query must not be {@literal null}.
|
||||
* @param entityType 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}.
|
||||
* @since 4.1
|
||||
*/
|
||||
|
||||
@@ -205,7 +205,6 @@ public interface SearchOperations {
|
||||
|
||||
/**
|
||||
* Executes the given {@link Query} against elasticsearch and return result as {@link SearchHitsIterator}.
|
||||
* <p>
|
||||
*
|
||||
* @param <T> element return type
|
||||
* @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}.
|
||||
* <p>
|
||||
*
|
||||
* @param <T> element return type
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
|
||||
@@ -349,7 +349,7 @@ public class MappingBuilder {
|
||||
}
|
||||
|
||||
if (isNestedOrObjectProperty) {
|
||||
Iterator<? extends TypeInformation<?>> iterator = property.getPersistentEntityTypes().iterator();
|
||||
Iterator<? extends TypeInformation<?>> iterator = property.getPersistentEntityTypeInformation().iterator();
|
||||
ElasticsearchPersistentEntity<?> persistentEntity = iterator.hasNext()
|
||||
? elasticsearchConverter.getMappingContext().getPersistentEntity(iterator.next())
|
||||
: null;
|
||||
|
||||
@@ -157,7 +157,7 @@ public interface Query {
|
||||
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
|
||||
* @since 3.1
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.lang.Nullable;
|
||||
* @author Mohsin Husen
|
||||
* @author Peter-Josef Meisch
|
||||
* @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 {
|
||||
|
||||
|
||||
+7
-7
@@ -19,9 +19,9 @@ import java.lang.annotation.Annotation;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.enterprise.context.spi.CreationalContext;
|
||||
import javax.enterprise.inject.spi.Bean;
|
||||
import javax.enterprise.inject.spi.BeanManager;
|
||||
import jakarta.enterprise.context.spi.CreationalContext;
|
||||
import jakarta.enterprise.inject.spi.Bean;
|
||||
import jakarta.enterprise.inject.spi.BeanManager;
|
||||
|
||||
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
||||
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 beanManager must not be {@literal null}.
|
||||
* @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,
|
||||
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.");
|
||||
this.elasticsearchOperationsBean = operations;
|
||||
@@ -62,7 +62,7 @@ public class ElasticsearchRepositoryBean<T> extends CdiRepositoryBean<T> {
|
||||
|
||||
/*
|
||||
* (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
|
||||
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.reflect.Type;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.enterprise.event.Observes;
|
||||
import javax.enterprise.inject.UnsatisfiedResolutionException;
|
||||
import javax.enterprise.inject.spi.AfterBeanDiscovery;
|
||||
import javax.enterprise.inject.spi.Bean;
|
||||
import javax.enterprise.inject.spi.BeanManager;
|
||||
import javax.enterprise.inject.spi.ProcessBean;
|
||||
import jakarta.enterprise.event.Observes;
|
||||
import jakarta.enterprise.inject.UnsatisfiedResolutionException;
|
||||
import jakarta.enterprise.inject.spi.AfterBeanDiscovery;
|
||||
import jakarta.enterprise.inject.spi.Bean;
|
||||
import jakarta.enterprise.inject.spi.BeanManager;
|
||||
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.repository.cdi.CdiRepositoryBean;
|
||||
import org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport;
|
||||
@@ -43,14 +47,24 @@ import org.springframework.data.repository.cdi.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<>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
<T> void processBean(@Observes ProcessBean<T> processBean) {
|
||||
|
||||
Bean<T> bean = processBean.getBean();
|
||||
|
||||
for (Type type : bean.getTypes()) {
|
||||
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();
|
||||
|
||||
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);
|
||||
afterBeanDiscovery.addBean(repositoryBean);
|
||||
}
|
||||
}
|
||||
|
||||
private <T> CdiRepositoryBean<T> createRepositoryBean(Class<T> repositoryType, Set<Annotation> qualifiers,
|
||||
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.",
|
||||
ElasticsearchOperations.class.getName(), qualifiers));
|
||||
}
|
||||
|
||||
Bean<ElasticsearchOperations> elasticsearchOperationsBean = this.elasticsearchOperationsMap.get(qualifiers);
|
||||
|
||||
return new ElasticsearchRepositoryBean<>(elasticsearchOperationsBean, qualifiers, repositoryType, beanManager,
|
||||
getCustomImplementationDetector());
|
||||
return new ElasticsearchRepositoryBean<>(elasticsearchOperations, qualifiers, repositoryType, beanManager,
|
||||
Optional.of(getCustomImplementationDetector()));
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -54,10 +54,10 @@ public class ConvertingParameterAccessor implements ElasticsearchParameterAccess
|
||||
return delegate.getSort();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Class<?>> getDynamicProjection() {
|
||||
return delegate.getDynamicProjection();
|
||||
}
|
||||
// @Override
|
||||
// public Optional<Class<?>> getDynamicProjection() {
|
||||
// return delegate.getDynamicProjection();
|
||||
// }
|
||||
|
||||
@Override
|
||||
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.
|
||||
|
||||
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;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
|
||||
+4
-7
@@ -24,8 +24,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.enterprise.inject.se.SeContainer;
|
||||
import javax.enterprise.inject.se.SeContainerInitializer;
|
||||
import jakarta.enterprise.inject.se.SeContainer;
|
||||
import jakarta.enterprise.inject.se.SeContainerInitializer;
|
||||
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
@@ -49,7 +49,7 @@ import org.springframework.lang.Nullable;
|
||||
@IntegrationTest
|
||||
public class CdiRepositoryTests {
|
||||
|
||||
@Nullable private static SeContainer container;
|
||||
@SuppressWarnings("NotNullFieldNotInitialized") private static SeContainer container;
|
||||
|
||||
// @Nullable private static CdiTestContainer cdiContainer;
|
||||
private CdiProductRepository repository;
|
||||
@@ -67,10 +67,7 @@ public class CdiRepositoryTests {
|
||||
|
||||
@AfterAll
|
||||
public static void shutdown() throws Exception {
|
||||
|
||||
if (container != null) {
|
||||
container.close();
|
||||
}
|
||||
container.close();
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
|
||||
+3
-3
@@ -15,9 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.repositories.cdi;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
import javax.enterprise.inject.Produces;
|
||||
import jakarta.annotation.PreDestroy;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.enterprise.inject.Produces;
|
||||
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
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.Target;
|
||||
|
||||
import javax.inject.Qualifier;
|
||||
import jakarta.inject.Qualifier;
|
||||
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import javax.inject.Qualifier;
|
||||
import jakarta.inject.Qualifier;
|
||||
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
|
||||
-9
@@ -91,15 +91,6 @@ class StubParameterAccessor implements ElasticsearchParameterAccessor {
|
||||
return this.values;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.query.ParameterAccessor#getDynamicProjection()
|
||||
*/
|
||||
@Override
|
||||
public Optional<Class<?>> getDynamicProjection() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.query.ParameterAccessor#findDynamicProjection()
|
||||
|
||||
Reference in New Issue
Block a user