-
Notifications
You must be signed in to change notification settings - Fork 40.6k
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
ClassCastException in SpringBoot 2.1.2 with swagger 2.6.0 and consul 1.4.1 #15788
Comments
This doesn't look like a problem in Spring Boot to me. If you would like us to spend any more time looking at this, please take the time to explain why you believe it's a bug in Spring Boot and to provide a minimal and complete example (as a zip attached to this issue or in a Git repository) that works with Spring Boot 1.5 and fails with 2.1. |
Perhaps you are using the interceptor provided by the spring boot. @Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(routingSessionInterceptor())
.addPathPatterns("/**")
.excludePathPatterns("/swagger**", "/webjars/springfox-swagger-ui/**");
} |
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. |
Thanks @tuorao this works. |
I'm not that I understand why the above works, but I'm glad that it does. In the absence of a sample that we could look at, we won't be able to propose a better solution if one should exist so I'm going to close this one. We can re-open it in the future if the requested sample is provided. |
I'll make a sample of this problem. |
https://github.com/tuorao/sample-code After downloading and executing this project, http://localhost:8080/swagger-ui.html and check addInterceptor method |
Thanks for the sample. Due to an enhancement in Spring Framework, interceptors are now called when accessing static resources. As such, you cannot assume that every |
@wilkinsona Is this issue classCastException fixed on 2.1.3.RELEASE ? When i call the /health endpoint it still throws the ClassCastException. |
@Hyerram No. There was nothing to fix in Spring Boot. The bug was in application code in an interceptor that was making a faulty assumption that the handler would always be a |
Found that we need to call /actuator/health instead of /health in all spring 2.X upgrades. |
Upgrading from spring boot 1.5.x to 2.1.2. Creating ClassCastException while checking the swagger ui, throws ClassCastException, Actual behavior Interceptors processing static resource requests, so manually excluded the static resources while registering. Appreciated if someone resolves without excluding manually.
The text was updated successfully, but these errors were encountered: