-
Notifications
You must be signed in to change notification settings - Fork 563
Avoid misconfiguration of controller overrides [DATAREST-1591] #1946
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
Comments
Oliver Drotbohm commented This fundamentally works as designed. You need to make sure that your controller is not picked up by Spring MVC by accident. Your current controller setup unfortunately does so. The crucial bits to get this to work are:
This makes all requests up until the PATCH one work. For the one accessing the the item resources work, too, remove the Finally |
Karsten Ludwig Hauser commented Thanks |
Oliver Drotbohm commented After thinking about this for a while, let me reopen the ticket and take the chance to improve a bit to avoid others have to waste time on this and make the time you invested a bit more worthwhile. We can detect this problem at bootstrap time and we can reject those misconfigurations. A controller looking like this is never a valid one and we can tell you that.
I'll schedule that for inclusion in the next milestone.
|
Karsten Ludwig Hauser commented I adjusted the project and all is working fine now. But now I also have another project where it only works with It also would be great if classes like ReplaceOperation, AddOperation, etc. would be public. I would like to use them on client side. Plus RestMediaTypes.JSON_PATCH_JSON_VALUE to easly add it to a FeignCLient. |
Oliver Drotbohm commented
That doesn't seem to be the case. The test case works just fine with the annotation removed.
For one, this doesn't have to do anything with the issue discussed here and we have to perform a bit of ticket hygiene to not get lost in "Oh, and this… oh, and that". |
…stMapping. When we detected @BasePathAwareController and @RepositoryRestController instances, we now reject types that use @RequestMapping on the class level as doing so causes an inevitable registration of the controller with Spring MVC. Fixes #1342, #1628, #1686, #1946.
…stMapping. When we detected @BasePathAwareController and @RepositoryRestController instances, we now reject types that use @RequestMapping on the class level as doing so causes an inevitable registration of the controller with Spring MVC. Fixes #1342, #1628, #1686, #1946.
…stMapping. When we detected @BasePathAwareController and @RepositoryRestController instances, we now reject types that use @RequestMapping on the class level as doing so causes an inevitable registration of the controller with Spring MVC. Fixes #1342, #1628, #1686, #1946.
Duplicates #1342. See the my latest comment over there. |
Karsten Ludwig Hauser opened DATAREST-1591 and commented
Calling
results in
when a custom RestController having the same mapping path as the repository.
Please check with the project behind the reference url.
Affects: 3.3.6 (Neumann SR6)
Reference URL: https://github.com/khauser/JsonPatchShowcase
The text was updated successfully, but these errors were encountered: