Add ValueExpression infrastructure for query methods#3050
Closed
Add ValueExpression infrastructure for query methods#3050
ValueExpression infrastructure for query methods#3050Conversation
d2d5256 to
3629ff8
Compare
| Assert.notNull(extensions, "EvaluationContextExtensions must not be null"); | ||
|
|
||
| this.delegate = new org.springframework.data.spel.ExtensionAwareEvaluationContextProvider(extensions); | ||
| this.delegate = new QueryMethodValueEvaluationContextAccessor(null, extensions); |
Member
There was a problem hiding this comment.
why are we using null here for the Environment? In L:71 a new StandardEnvironment is passed on.
Comment on lines
+174
to
+184
| parameters.stream()// | ||
| .filter(Parameter::isSpecialParameter)// | ||
| .forEach(it -> variables.put(// | ||
| StringUtils.uncapitalize(it.getType().getSimpleName()), // | ||
| arguments[it.getIndex()])); | ||
|
|
||
| parameters.stream()// | ||
| .filter(Parameter::isNamedParameter)// | ||
| .forEach(it -> variables.put(// | ||
| it.getName().orElseThrow(() -> new IllegalStateException("Should never occur")), // | ||
| arguments[it.getIndex()])); |
Member
There was a problem hiding this comment.
can't we put this in one stream processing instead of running over parameters twice?
Comment on lines
+217
to
+235
| if (evaluationContext instanceof StandardEvaluationContext sec | ||
| && rootObject instanceof Object[] parameterValues) { | ||
| sec.setVariables(collectVariables(parameters, parameterValues)); | ||
| } |
Member
There was a problem hiding this comment.
Should we add variables for a given SimpleEvaluationContext as well?
bc3a03e to
ba80df6
Compare
Introduce ValueExpressionQueryRewriter as replacement for SpelQueryContext and QueryMethodValueEvaluationContextAccessor to encapsulate common ValueExpression functionality for Spring Data modules wanting to resolve Value Expressions in query methods. Reduce dependencies in RepositoryFactoryBeanSupport and RepositoryFactorySupport to EvaluationContextProvider instead of QueryMethodEvaluationContextProvider to simplify dependencies. Deprecate QueryMethodEvaluationContextProvider and its reactive variant for future removal. Closes #3049
414ff4f to
c1d8d93
Compare
… a EvaluatingValueExpressionQueryRewriter directly.
mp911de
added a commit
that referenced
this pull request
Oct 9, 2024
Introduce ValueExpressionQueryRewriter as replacement for SpelQueryContext and QueryMethodValueEvaluationContextAccessor to encapsulate common ValueExpression functionality for Spring Data modules wanting to resolve Value Expressions in query methods. Reduce dependencies in RepositoryFactoryBeanSupport and RepositoryFactorySupport to EvaluationContextProvider instead of QueryMethodEvaluationContextProvider to simplify dependencies. Deprecate QueryMethodEvaluationContextProvider and its reactive variant for future removal. Closes #3049 Original pull request: #3050
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce
ValueExpressionQueryRewriteras replacement forSpelQueryContext.Closes #3049