Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MethodValidationInterceptor is added after ImplementationMethodExecutionInterceptor #3141

Open
riba2101 opened this issue Aug 24, 2024 · 6 comments
Assignees
Labels
status: feedback-provided Feedback has been provided status: pending-design-work Needs design work before any code can be developed status: waiting-for-triage An issue we've not yet triaged

Comments

@riba2101
Copy link

Hi,

long story short: org.springframework.aop.framework.ReflectiveMethodInvocation.proceed does not go trough the whole chain and after RepositoryFactorySupport.ImplementationMethodExecutionInterceptor the MethodValidationInterceptoris not being called. That being said, MethodValidationInterceptor should be higher up in the chain?

BR

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 24, 2024
@mp911de
Copy link
Member

mp911de commented Aug 26, 2024

If you would like us to spend some time helping you to diagnose the problem, please spend some time describing it and, ideally, providing a minimal yet complete sample that reproduces the problem.
You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

@mp911de mp911de added the status: waiting-for-feedback We need additional information before we can continue label Aug 26, 2024
@spring-projects-issues
Copy link

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Sep 2, 2024
@riba2101
Copy link
Author

riba2101 commented Sep 2, 2024

hi,

sry for the wait, was a bit busy - the repo can be found here: https://github.com/riba2101/spring-data-validaition-demo

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Sep 2, 2024
@mp911de mp911de changed the title The story behind ReflectiveMethodInvocation and ImplementationMethodExecutionInterceptor and MethodValidationInterceptor MethodValidationInterceptor is added after ImplementationMethodExecutionInterceptor Sep 3, 2024
@mp911de
Copy link
Member

mp911de commented Sep 3, 2024

Spring Data repository invocations are dispatched by ImplementationMethodExecutionInterceptor. However, we still set a target source and therefore, the bean post-processor inserts MethodValidationInterceptor at the end of the advisory chain.

If we do not set the target source in RepositoryFactorySupport, then the bean post-processor inserts MethodValidationInterceptor before ImplementationMethodExecutionInterceptor and so it invokes the validator.

Have you locally tried to change RepositoryFactorySupport to see whether the change would make sense to you?

@mp911de mp911de added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Sep 3, 2024
@riba2101
Copy link
Author

riba2101 commented Sep 3, 2024

oh, to be fair i didnt try it, a nice idea...
this would be nice to document and/or make the process easier to integrate? since the MethodValidationInterceptor or rather the AOP validation is a global "feature" in the spring ecosystem, it would make sense to treat it as such?

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Sep 3, 2024
@mp911de
Copy link
Member

mp911de commented Sep 3, 2024

If such a change works for you, then we would apply that one globally so that there's no need for customizations.

@mp911de mp911de added the status: pending-design-work Needs design work before any code can be developed label Sep 9, 2024
@mp911de mp911de self-assigned this Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: feedback-provided Feedback has been provided status: pending-design-work Needs design work before any code can be developed status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

3 participants