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

Validation not working properly with @RestControllerEndpoint custom actuator #12441

Closed
debbiche opened this issue Mar 12, 2018 · 1 comment

Comments

Projects
None yet
4 participants
@debbiche
Copy link

commented Mar 12, 2018

I have a custom actuator that uses @RestControllerEndpoint since it allows me to use complex DTOs among other things. However, I cannot get validation of path parameters or DTOs to work.

Issues I have encountered:

  1. Adding @Validated to a class with @RestControllerEndpoint annotation causes the actuator not be exposed anymore. All rest calls return 404. Using the annotation on a method level seems to work.

  2. Validating a path parameter with for instance @Size does not work. Not sure if this is because of my set up or due to a bug.

Sample project:
Just run the application and use the actuator at localhost:8080/actuator/flows. Uncomment the @Validated annotation to reproduce the problem.

https://github.com/debbiche/spring-boot-actuator-validation-bug

Spring boot version: 2.0.0 RELEASE

@geo-m

This comment has been minimized.

Copy link
Contributor

commented Mar 31, 2018

I was also impacted by this. Turns out the @Validated annotation creates a CGLIB proxy, which messes with the type of the Endpoint and considers it a DiscoveredWebEndpoint with no methods instead of a DiscoveredControllerEndpoint.

Im not familiar with how spring works internally yet, so i cant give you a solution unless someone helps

@snicoll snicoll added this to the 2.0.x milestone Apr 3, 2018

@snicoll snicoll self-assigned this Apr 10, 2018

@snicoll snicoll modified the milestones: 2.0.x, 2.0.2 Apr 10, 2018

@snicoll snicoll closed this in e8fac7d Apr 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.