@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2025 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import org.springframework.data.mapping.model.DefaultSpELExpressionEvaluator;
|
||||
import org.springframework.data.mapping.model.SpELExpressionEvaluator;
|
||||
|
||||
import com.datastax.oss.driver.api.core.cql.Row;
|
||||
import com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry;
|
||||
|
||||
/**
|
||||
* {@link CassandraValueProvider} to read property values from a {@link Row}.
|
||||
*
|
||||
* @author Alex Shvid
|
||||
* @author Matthew T. Adams
|
||||
* @author David Webb
|
||||
* @author Mark Paluch
|
||||
* @deprecated since 3.0, use directly {@link RowValueProvider}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class BasicCassandraRowValueProvider extends RowValueProvider {
|
||||
|
||||
/**
|
||||
* Create a new {@link BasicCassandraRowValueProvider} with the given {@link Row}, {@link CodecRegistry} and
|
||||
* {@link SpELExpressionEvaluator}.
|
||||
*
|
||||
* @param source must not be {@literal null}.
|
||||
* @param codecRegistry must not be {@literal null}.
|
||||
* @param evaluator must not be {@literal null}.
|
||||
* @since 2.1
|
||||
*/
|
||||
public BasicCassandraRowValueProvider(Row source, CodecRegistry codecRegistry, SpELExpressionEvaluator evaluator) {
|
||||
super(source, evaluator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link BasicCassandraRowValueProvider} with the given {@link Row} and
|
||||
* {@link DefaultSpELExpressionEvaluator}.
|
||||
*
|
||||
* @param source must not be {@literal null}.
|
||||
* @param evaluator must not be {@literal null}.
|
||||
* @deprecated since 2.1, use {@link #BasicCassandraRowValueProvider(Row, CodecRegistry, SpELExpressionEvaluator)}
|
||||
*/
|
||||
@Deprecated
|
||||
public BasicCassandraRowValueProvider(Row source, DefaultSpELExpressionEvaluator evaluator) {
|
||||
super(source, evaluator);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018-2025 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import org.springframework.data.mapping.model.SpELExpressionEvaluator;
|
||||
|
||||
import com.datastax.oss.driver.api.core.data.TupleValue;
|
||||
import com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry;
|
||||
|
||||
/**
|
||||
* {@link CassandraValueProvider} to read property values from a {@link TupleValue}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @since 2.1
|
||||
* @deprecated since 3.0, use {@link TupleValueProvider} directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public class CassandraTupleValueProvider extends TupleValueProvider {
|
||||
|
||||
/**
|
||||
* Create a new {@link CassandraTupleValueProvider} with the given {@link TupleValue} and
|
||||
* {@link SpELExpressionEvaluator}.
|
||||
*
|
||||
* @param tupleValue must not be {@literal null}.
|
||||
* @param codecRegistry must not be {@literal null}.
|
||||
* @param evaluator must not be {@literal null}.
|
||||
*/
|
||||
public CassandraTupleValueProvider(TupleValue tupleValue, CodecRegistry codecRegistry,
|
||||
SpELExpressionEvaluator evaluator) {
|
||||
super(tupleValue, evaluator);
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2025 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import org.springframework.data.mapping.model.DefaultSpELExpressionEvaluator;
|
||||
import org.springframework.data.mapping.model.SpELExpressionEvaluator;
|
||||
|
||||
import com.datastax.oss.driver.api.core.data.UdtValue;
|
||||
import com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry;
|
||||
|
||||
/**
|
||||
* {@link CassandraValueProvider} to read property values from a {@link UdtValue}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @since 1.5
|
||||
* @deprecated since 3.0, use {@link UdtValueProvider} directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public class CassandraUDTValueProvider extends UdtValueProvider {
|
||||
|
||||
/**
|
||||
* Create a new {@link CassandraUDTValueProvider} with the given {@link UdtValue} and {@link SpELExpressionEvaluator}.
|
||||
*
|
||||
* @param udtValue must not be {@literal null}.
|
||||
* @param codecRegistry must not be {@literal null}.
|
||||
* @param evaluator must not be {@literal null}.
|
||||
* @since 2.1
|
||||
*/
|
||||
public CassandraUDTValueProvider(UdtValue udtValue, CodecRegistry codecRegistry, SpELExpressionEvaluator evaluator) {
|
||||
super(udtValue, evaluator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link CassandraUDTValueProvider} with the given {@link UdtValue} and
|
||||
* {@link DefaultSpELExpressionEvaluator}.
|
||||
*
|
||||
* @param udtValue must not be {@literal null}.
|
||||
* @param codecRegistry must not be {@literal null}.
|
||||
* @param evaluator must not be {@literal null}.
|
||||
* @deprecated since 2.1, use {@link #CassandraUDTValueProvider(UdtValue, CodecRegistry, SpELExpressionEvaluator)}
|
||||
*/
|
||||
@Deprecated
|
||||
public CassandraUDTValueProvider(UdtValue udtValue, CodecRegistry codecRegistry,
|
||||
DefaultSpELExpressionEvaluator evaluator) {
|
||||
super(udtValue, evaluator);
|
||||
}
|
||||
}
|
||||
@@ -413,7 +413,7 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
if (mappedEntity.requiresPropertyPopulation()) {
|
||||
|
||||
PersistentPropertyAccessor<R> accessor = mappedEntity.getPropertyAccessor(instance);
|
||||
readProperties(context, mappedEntity, valueProviderToUse, accessor, isConstructorArgument(mappedEntity).negate());
|
||||
readProperties(context, mappedEntity, valueProviderToUse, accessor, isCreatorArgument(mappedEntity).negate());
|
||||
return accessor.getBean();
|
||||
}
|
||||
|
||||
@@ -592,7 +592,7 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
}
|
||||
|
||||
ConvertingPropertyAccessor<S> propertyAccessor = newConvertingPropertyAccessor(instance, entity);
|
||||
readProperties(context, entity, valueProvider, propertyAccessor, isConstructorArgument(entity).negate());
|
||||
readProperties(context, entity, valueProvider, propertyAccessor, isCreatorArgument(entity).negate());
|
||||
return propertyAccessor.getBean();
|
||||
}
|
||||
|
||||
@@ -1308,8 +1308,8 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
return Map.class.isAssignableFrom(mapType) ? mapType : Map.class;
|
||||
}
|
||||
|
||||
static Predicate<CassandraPersistentProperty> isConstructorArgument(PersistentEntity<?, ?> entity) {
|
||||
return entity::isConstructorArgument;
|
||||
static Predicate<CassandraPersistentProperty> isCreatorArgument(PersistentEntity<?, ?> entity) {
|
||||
return entity::isCreatorArgument;
|
||||
}
|
||||
|
||||
enum NoOpParameterValueProvider implements ParameterValueProvider<CassandraPersistentProperty> {
|
||||
|
||||
@@ -139,21 +139,11 @@ public class EmbeddedEntityOperations {
|
||||
}
|
||||
|
||||
@Override
|
||||
@org.springframework.lang.Nullable
|
||||
public PreferredConstructor<T, CassandraPersistentProperty> getPersistenceConstructor() {
|
||||
return delegate.getPersistenceConstructor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public InstanceCreatorMetadata<CassandraPersistentProperty> getInstanceCreatorMetadata() {
|
||||
return delegate.getInstanceCreatorMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConstructorArgument(PersistentProperty<?> property) {
|
||||
return delegate.isConstructorArgument(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCreatorArgument(PersistentProperty<?> property) {
|
||||
return delegate.isCreatorArgument(property);
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.data.repository.query.Parameters;
|
||||
import org.springframework.data.repository.query.ParametersSource;
|
||||
import org.springframework.data.repository.util.QueryExecutionConverters;
|
||||
import org.springframework.data.repository.util.ReactiveWrapperConverters;
|
||||
import org.springframework.data.repository.util.ReactiveWrappers;
|
||||
import org.springframework.data.util.ReactiveWrappers;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
|
||||
@@ -26,11 +26,11 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
import org.springframework.data.repository.util.ReactiveWrapperConverters;
|
||||
import org.springframework.data.repository.util.ReactiveWrappers;
|
||||
import org.springframework.data.util.ReactiveWrappers;
|
||||
|
||||
/**
|
||||
* Reactive {@link org.springframework.data.repository.query.ParametersParameterAccessor} implementation that subscribes
|
||||
* to reactive parameter wrapper types upon creation. This class performs synchronization when acessing parameters.
|
||||
* to reactive parameter wrapper types upon creation. This class performs synchronization when accessing parameters.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @since 2.0
|
||||
|
||||
@@ -17,19 +17,13 @@ package org.springframework.data.cassandra.repository.query;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.core.env.StandardEnvironment;
|
||||
import org.springframework.data.cassandra.core.ReactiveCassandraOperations;
|
||||
import org.springframework.data.cassandra.repository.Query;
|
||||
import org.springframework.data.expression.ReactiveValueEvaluationContextProvider;
|
||||
import org.springframework.data.expression.ValueEvaluationContextProvider;
|
||||
import org.springframework.data.expression.ValueExpressionParser;
|
||||
import org.springframework.data.mapping.model.ValueExpressionEvaluator;
|
||||
import org.springframework.data.repository.query.QueryMethodEvaluationContextProvider;
|
||||
import org.springframework.data.repository.query.QueryMethodValueEvaluationContextAccessor;
|
||||
import org.springframework.data.repository.query.ReactiveQueryMethodEvaluationContextProvider;
|
||||
import org.springframework.data.repository.query.ValueExpressionDelegate;
|
||||
import org.springframework.data.spel.ExpressionDependencies;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -62,50 +56,6 @@ public class ReactiveStringBasedCassandraQuery extends AbstractReactiveCassandra
|
||||
|
||||
private final ReactiveValueEvaluationContextProvider valueEvaluationContextProvider;
|
||||
|
||||
/**
|
||||
* Create a new {@link ReactiveStringBasedCassandraQuery} for the given {@link CassandraQueryMethod},
|
||||
* {@link ReactiveCassandraOperations}, {@link SpelExpressionParser}, and
|
||||
* {@link QueryMethodEvaluationContextProvider}.
|
||||
*
|
||||
* @param queryMethod {@link ReactiveCassandraQueryMethod} on which this query is based.
|
||||
* @param operations {@link ReactiveCassandraOperations} used to perform data access in Cassandra.
|
||||
* @param expressionParser {@link SpelExpressionParser} used to parse expressions in the query.
|
||||
* @param evaluationContextProvider {@link QueryMethodEvaluationContextProvider} used to access the potentially shared
|
||||
* {@link org.springframework.expression.spel.support.StandardEvaluationContext}.
|
||||
* @see org.springframework.data.cassandra.repository.query.ReactiveCassandraQueryMethod
|
||||
* @see org.springframework.data.cassandra.core.ReactiveCassandraOperations
|
||||
* @deprecated since 4.4, use the constructors accepting {@link ValueExpressionDelegate} instead.
|
||||
*/
|
||||
@Deprecated(since = "4.4")
|
||||
public ReactiveStringBasedCassandraQuery(ReactiveCassandraQueryMethod queryMethod,
|
||||
ReactiveCassandraOperations operations, ExpressionParser expressionParser,
|
||||
ReactiveQueryMethodEvaluationContextProvider evaluationContextProvider) {
|
||||
|
||||
this(queryMethod.getRequiredAnnotatedQuery(), queryMethod, operations, expressionParser, evaluationContextProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link ReactiveStringBasedCassandraQuery} for the given {@code query}, {@link CassandraQueryMethod},
|
||||
* {@link ReactiveCassandraOperations}, {@link SpelExpressionParser}, and
|
||||
* {@link QueryMethodEvaluationContextProvider}.
|
||||
*
|
||||
* @param method {@link ReactiveCassandraQueryMethod} on which this query is based.
|
||||
* @param operations {@link ReactiveCassandraOperations} used to perform data access in Cassandra.
|
||||
* @param expressionParser {@link SpelExpressionParser} used to parse expressions in the query.
|
||||
* @param evaluationContextProvider {@link QueryMethodEvaluationContextProvider} used to access the potentially shared
|
||||
* {@link org.springframework.expression.spel.support.StandardEvaluationContext}.
|
||||
* @see org.springframework.data.cassandra.repository.query.ReactiveCassandraQueryMethod
|
||||
* @see org.springframework.data.cassandra.core.ReactiveCassandraOperations
|
||||
* @deprecated since 4.4, use the constructors accepting {@link ValueExpressionDelegate} instead.
|
||||
*/
|
||||
@Deprecated(since = "4.4")
|
||||
public ReactiveStringBasedCassandraQuery(String query, ReactiveCassandraQueryMethod method,
|
||||
ReactiveCassandraOperations operations, ExpressionParser expressionParser,
|
||||
ReactiveQueryMethodEvaluationContextProvider evaluationContextProvider) {
|
||||
|
||||
this(query, method, operations, new ValueExpressionDelegate(new QueryMethodValueEvaluationContextAccessor(new StandardEnvironment(), evaluationContextProvider.getEvaluationContextProvider()), ValueExpressionParser.create(() -> expressionParser)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link ReactiveStringBasedCassandraQuery} for the given {@link CassandraQueryMethod},
|
||||
* {@link ReactiveCassandraOperations}, {@link ValueExpressionDelegate}
|
||||
@@ -145,9 +95,9 @@ public class ReactiveStringBasedCassandraQuery extends AbstractReactiveCassandra
|
||||
|
||||
this.stringBasedQuery = new StringBasedQuery(query, method.getParameters(), delegate);
|
||||
|
||||
ValueEvaluationContextProvider valueContextProvider = delegate.createValueContextProvider(
|
||||
method.getParameters());
|
||||
Assert.isInstanceOf(ReactiveValueEvaluationContextProvider.class, valueContextProvider, "ValueEvaluationContextProvider must be reactive");
|
||||
ValueEvaluationContextProvider valueContextProvider = delegate.createValueContextProvider(method.getParameters());
|
||||
Assert.isInstanceOf(ReactiveValueEvaluationContextProvider.class, valueContextProvider,
|
||||
"ValueEvaluationContextProvider must be reactive");
|
||||
this.valueEvaluationContextProvider = (ReactiveValueEvaluationContextProvider) valueContextProvider;
|
||||
|
||||
if (method.hasAnnotatedQuery()) {
|
||||
|
||||
@@ -15,16 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.repository.query;
|
||||
|
||||
import org.springframework.core.env.StandardEnvironment;
|
||||
import org.springframework.data.cassandra.core.CassandraOperations;
|
||||
import org.springframework.data.cassandra.repository.Query;
|
||||
import org.springframework.data.expression.ValueEvaluationContext;
|
||||
import org.springframework.data.expression.ValueExpressionParser;
|
||||
import org.springframework.data.repository.query.QueryMethodEvaluationContextProvider;
|
||||
import org.springframework.data.repository.query.QueryMethodValueEvaluationContextAccessor;
|
||||
import org.springframework.data.repository.query.ValueExpressionDelegate;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
|
||||
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
|
||||
|
||||
@@ -53,26 +47,6 @@ public class StringBasedCassandraQuery extends AbstractCassandraQuery {
|
||||
|
||||
private final ValueExpressionDelegate valueExpressionDelegate;
|
||||
|
||||
/**
|
||||
* Create a new {@link StringBasedCassandraQuery} for the given {@link CassandraQueryMethod},
|
||||
* {@link CassandraOperations}, {@link SpelExpressionParser}, and {@link QueryMethodEvaluationContextProvider}.
|
||||
*
|
||||
* @param queryMethod {@link CassandraQueryMethod} on which this query is based.
|
||||
* @param operations {@link CassandraOperations} used to perform data access in Cassandra.
|
||||
* @param expressionParser {@link SpelExpressionParser} used to parse expressions in the query.
|
||||
* @param evaluationContextProvider {@link QueryMethodEvaluationContextProvider} used to access the potentially shared
|
||||
* {@link org.springframework.expression.spel.support.StandardEvaluationContext}.
|
||||
* @see org.springframework.data.cassandra.repository.query.CassandraQueryMethod
|
||||
* @see org.springframework.data.cassandra.core.CassandraOperations
|
||||
* @deprecated use the constructor version with {@link ValueExpressionDelegate}
|
||||
*/
|
||||
@Deprecated(since = "4.4")
|
||||
public StringBasedCassandraQuery(CassandraQueryMethod queryMethod, CassandraOperations operations,
|
||||
ExpressionParser expressionParser, QueryMethodEvaluationContextProvider evaluationContextProvider) {
|
||||
|
||||
this(queryMethod.getRequiredAnnotatedQuery(), queryMethod, operations, expressionParser, evaluationContextProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link StringBasedCassandraQuery} for the given {@link CassandraQueryMethod},
|
||||
* {@link CassandraOperations}, {@link ValueExpressionDelegate}.
|
||||
@@ -127,27 +101,7 @@ public class StringBasedCassandraQuery extends AbstractCassandraQuery {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link StringBasedCassandraQuery} for the given {@code query}, {@link CassandraQueryMethod},
|
||||
* {@link CassandraOperations}, {@link SpelExpressionParser}, and {@link QueryMethodEvaluationContextProvider}.
|
||||
*
|
||||
* @param query {@link String} containing the Apache Cassandra CQL query to execute.
|
||||
* @param method {@link CassandraQueryMethod} on which this query is based.
|
||||
* @param operations {@link CassandraOperations} used to perform data access in Cassandra.
|
||||
* @param expressionParser {@link SpelExpressionParser} used to parse expressions in the query.
|
||||
* @param evaluationContextProvider {@link QueryMethodEvaluationContextProvider} used to access the potentially shared
|
||||
* {@link org.springframework.expression.spel.support.StandardEvaluationContext}.
|
||||
* @see org.springframework.data.cassandra.repository.query.CassandraQueryMethod
|
||||
* @see org.springframework.data.cassandra.core.CassandraOperations
|
||||
* @deprecated use the constructor version with {@link ValueExpressionDelegate}
|
||||
*/
|
||||
@Deprecated(since = "4.4")
|
||||
public StringBasedCassandraQuery(String query, CassandraQueryMethod method, CassandraOperations operations,
|
||||
ExpressionParser expressionParser, QueryMethodEvaluationContextProvider evaluationContextProvider) {
|
||||
this(query, method, operations, new ValueExpressionDelegate(new QueryMethodValueEvaluationContextAccessor(new StandardEnvironment(), evaluationContextProvider.getEvaluationContextProvider()), ValueExpressionParser.create(() -> expressionParser)));
|
||||
}
|
||||
|
||||
protected StringBasedQuery getStringBasedQuery() {
|
||||
StringBasedQuery getStringBasedQuery() {
|
||||
return this.stringBasedQuery;
|
||||
}
|
||||
|
||||
@@ -157,8 +111,9 @@ public class StringBasedCassandraQuery extends AbstractCassandraQuery {
|
||||
StringBasedQuery query = getStringBasedQuery();
|
||||
ConvertingParameterAccessor parameterAccessorToUse = new ConvertingParameterAccessor(getOperations().getConverter(),
|
||||
parameterAccessor);
|
||||
ValueEvaluationContext evaluationContext = valueExpressionDelegate.createValueContextProvider(
|
||||
getQueryMethod().getParameters()).getEvaluationContext(parameterAccessorToUse.getValues(), query.getExpressionDependencies());
|
||||
ValueEvaluationContext evaluationContext = valueExpressionDelegate
|
||||
.createValueContextProvider(getQueryMethod().getParameters())
|
||||
.getEvaluationContext(parameterAccessorToUse.getValues(), query.getExpressionDependencies());
|
||||
|
||||
return getQueryStatementCreator().select(query, parameterAccessorToUse,
|
||||
new ContextualValueExpressionEvaluator(valueExpressionDelegate, evaluationContext));
|
||||
|
||||
@@ -15,16 +15,11 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.repository.support;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.data.cassandra.core.ReactiveCassandraOperations;
|
||||
import org.springframework.data.mapping.context.MappingContext;
|
||||
import org.springframework.data.repository.Repository;
|
||||
import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport;
|
||||
import org.springframework.data.repository.core.support.RepositoryFactorySupport;
|
||||
import org.springframework.data.repository.query.QueryMethodEvaluationContextProvider;
|
||||
import org.springframework.data.repository.query.ReactiveExtensionAwareQueryMethodEvaluationContextProvider;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -78,12 +73,6 @@ public class ReactiveCassandraRepositoryFactoryBean<T extends Repository<S, ID>,
|
||||
return getFactoryInstance(operations);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Optional<QueryMethodEvaluationContextProvider> createDefaultQueryMethodEvaluationContextProvider(
|
||||
ListableBeanFactory beanFactory) {
|
||||
return Optional.of(new ReactiveExtensionAwareQueryMethodEvaluationContextProvider(beanFactory));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and initializes a {@link RepositoryFactorySupport} instance.
|
||||
*
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.dao.OptimisticLockingFailureException;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.data.annotation.PersistenceCreator;
|
||||
import org.springframework.data.annotation.Version;
|
||||
import org.springframework.data.cassandra.core.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.core.cql.CqlTemplate;
|
||||
@@ -150,7 +150,7 @@ class AsyncOptimisticLockingIntegrationTests extends AbstractKeyspaceCreatingInt
|
||||
this(id, 0, null);
|
||||
}
|
||||
|
||||
@PersistenceConstructor
|
||||
@PersistenceCreator
|
||||
private VersionedEntity(long id, long version, String name) {
|
||||
this.id = id;
|
||||
this.version = version;
|
||||
|
||||
@@ -19,9 +19,10 @@ import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.OptimisticLockingFailureException;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.data.annotation.PersistenceCreator;
|
||||
import org.springframework.data.annotation.Version;
|
||||
import org.springframework.data.cassandra.core.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.repository.support.SchemaTestUtils;
|
||||
@@ -136,7 +137,7 @@ class OptimisticLockingIntegrationTests extends AbstractKeyspaceCreatingIntegrat
|
||||
this(id, 0, null);
|
||||
}
|
||||
|
||||
@PersistenceConstructor
|
||||
@PersistenceCreator
|
||||
private VersionedEntity(long id, long version, String name) {
|
||||
this.id = id;
|
||||
this.version = version;
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.dao.OptimisticLockingFailureException;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.data.annotation.PersistenceCreator;
|
||||
import org.springframework.data.annotation.Version;
|
||||
import org.springframework.data.cassandra.core.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.core.cql.CqlTemplate;
|
||||
@@ -159,7 +159,7 @@ class ReactiveOptimisticLockingIntegrationTests extends AbstractKeyspaceCreating
|
||||
this(id, 0, null);
|
||||
}
|
||||
|
||||
@PersistenceConstructor
|
||||
@PersistenceCreator
|
||||
private VersionedEntity(long id, long version, String name) {
|
||||
this.id = id;
|
||||
this.version = version;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.data.cassandra.domain;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.data.annotation.PersistenceCreator;
|
||||
import org.springframework.data.cassandra.core.mapping.Table;
|
||||
|
||||
/**
|
||||
@@ -41,7 +41,7 @@ public class User {
|
||||
|
||||
public User() {}
|
||||
|
||||
@PersistenceConstructor
|
||||
@PersistenceCreator
|
||||
public User(String id, String firstname, String lastname) {
|
||||
|
||||
this.id = id;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
package org.springframework.data.cassandra.domain;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.data.annotation.PersistenceCreator;
|
||||
import org.springframework.data.annotation.Version;
|
||||
import org.springframework.data.cassandra.core.mapping.Table;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -40,7 +40,7 @@ public class VersionedUser {
|
||||
private String firstname;
|
||||
private String lastname;
|
||||
|
||||
@PersistenceConstructor
|
||||
@PersistenceCreator
|
||||
public VersionedUser(String id, String firstname, String lastname) {
|
||||
|
||||
this.id = id;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CassandraRepositoryConfigurationExtensionUnitTests {
|
||||
private Environment environment = new StandardEnvironment();
|
||||
private BeanDefinitionRegistry registry = new DefaultListableBeanFactory();
|
||||
private RepositoryConfigurationSource configurationSource = new AnnotationRepositoryConfigurationSource(metadata,
|
||||
EnableCassandraRepositories.class, loader, environment, registry);
|
||||
EnableCassandraRepositories.class, loader, environment, registry, null);
|
||||
|
||||
private CassandraRepositoryConfigurationExtension extension;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ReactiveCassandraRepositoryConfigurationExtensionUnitTests {
|
||||
private Environment environment = new StandardEnvironment();
|
||||
private BeanDefinitionRegistry registry = new DefaultListableBeanFactory();
|
||||
private RepositoryConfigurationSource configurationSource = new AnnotationRepositoryConfigurationSource(metadata,
|
||||
EnableReactiveCassandraRepositories.class, loader, environment, registry);
|
||||
EnableReactiveCassandraRepositories.class, loader, environment, registry, null);
|
||||
|
||||
private ReactiveCassandraRepositoryConfigurationExtension extension;
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ import org.springframework.data.cassandra.test.util.IntegrationTestsSupport;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.repository.query.ExtensionAwareQueryMethodEvaluationContextProvider;
|
||||
import org.springframework.data.util.Version;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
import org.springframework.util.ClassUtils;
|
||||
@@ -113,7 +112,6 @@ public class SimpleCassandraRepositoryIntegrationTests extends IntegrationTestsS
|
||||
factory.setRepositoryBaseClass(SimpleCassandraRepository.class);
|
||||
factory.setBeanClassLoader(classLoader);
|
||||
factory.setBeanFactory(beanFactory);
|
||||
factory.setEvaluationContextProvider(ExtensionAwareQueryMethodEvaluationContextProvider.DEFAULT);
|
||||
|
||||
repository = factory.getRepository(UserRepostitory.class);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user