Skip to content

Commit

Permalink
Bump up spring data jdbc version to 3.3.0-M1 (#133)
Browse files Browse the repository at this point in the history
Reviewed by @chanhyeong @wool0826 

* Bump up spring data version to 3.3.0-M1

* Add support for ValueExpression
  • Loading branch information
IAM20 authored Mar 22, 2024
1 parent 42ca8b0 commit 2e4c8ae
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
springDataVersion=3.2.3
springDataCommonsVersion=3.2.3
springBootVersion=3.2.3
springDataVersion=3.3.0-M1
springDataCommonsVersion=3.3.0-M1
springBootVersion=3.3.0-M1
kotlinVersion=1.9.20
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,19 @@
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.PersistentPropertyAccessor;
import org.springframework.data.mapping.PersistentPropertyPath;
import org.springframework.data.mapping.model.DefaultSpELExpressionEvaluator;
import org.springframework.data.mapping.model.CachingValueExpressionEvaluatorFactory;
import org.springframework.data.mapping.model.ParameterValueProvider;
import org.springframework.data.mapping.model.SpELContext;
import org.springframework.data.mapping.model.SpELExpressionEvaluator;
import org.springframework.data.mapping.model.SpELExpressionParameterValueProvider;
import org.springframework.data.mapping.model.ValueExpressionEvaluator;
import org.springframework.data.mapping.model.ValueExpressionParameterValueProvider;
import org.springframework.data.projection.SpelAwareProxyProjectionFactory;
import org.springframework.data.relational.core.mapping.AggregatePath;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.util.Streamable;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
Expand All @@ -65,6 +68,14 @@
public class AggregateResultJdbcConverter extends MappingJdbcConverter {
private SpELContext spElContext;

private final ExpressionParser expressionParser = new SpelExpressionParser();

private final SpelAwareProxyProjectionFactory projectionFactory = new SpelAwareProxyProjectionFactory(
expressionParser);

private final CachingValueExpressionEvaluatorFactory valueExpressionEvaluatorFactory = new CachingValueExpressionEvaluatorFactory(
expressionParser, this, o -> spElContext.getEvaluationContext(o));

/**
* Instantiates a new Aggregate result jdbc converter.
*
Expand Down Expand Up @@ -1249,9 +1260,8 @@ private T createInstanceInternal(@Nullable Object idValue) {
ParameterValueProvider<RelationalPersistentProperty> provider;

if (creatorMetadata != null && creatorMetadata.hasParameters()) {
SpELExpressionEvaluator expressionEvaluator = new DefaultSpELExpressionEvaluator(this.entityMap,
spElContext);
provider = new SpELExpressionParameterValueProvider<>(expressionEvaluator, getConversionService(),
ValueExpressionEvaluator expressionEvaluator = valueExpressionEvaluatorFactory.create(this.entityMap);
provider = new ValueExpressionParameterValueProvider<>(expressionEvaluator, getConversionService(),
new ResultSetParameterValueProvider(idValue, entity));
} else {
provider = NoOpParameterValueProvider.INSTANCE;
Expand Down

0 comments on commit 2e4c8ae

Please sign in to comment.