Cannot intercept /v2/api-docs ?
See original GitHub issuespringfox 2.9.2 springboot 2.0.3
I want intercept /v2/api-docs
, The code is as follows, But,the code no entry into force !
why?why?why?
@Component
public class Swagger2WebMvcConfigurerAdapter extends WebMvcConfigurerAdapter{
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(getSwaggerInterceptor()).addPathPatterns("/v2/api-docs");
super.addInterceptors(registry);
}
@Bean
public HandlerInterceptor getSwaggerInterceptor() {
return new Swagger2Interceptor();
}
}
public class Swagger2Interceptor extends HandlerInterceptorAdapter{
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// I want to do something.
return super.preHandle(request, response, handler);
}
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
How to configure Spring Security to allow ... - Stack Overflow
Main issue: Not able to access swagger URL at http://localhost:8080/api/v2/api-docs. It says Missing or invalid Authorization header. Screenshot ...
Read more >Spring Boot 2.3.1 available now
This release includes 127 bug fixes, enhancements, documentation improvements, and dependency upgrades. Thanks to all those who have contributed ...
Read more >swagger-ui - npm
Function to intercept try-it-out responses. ... XMLHttpRequest cannot load http://sad.server.com/v2/api-docs.
Read more >Spring Boot run Error :: Application - Google Groups
After successful build when I run spring boot command I get below error. Attached is log. PLease help. C:\MyWork\shopizer\ ...
Read more >How to disable the custom atlassian spring boot interceptors ...
You can skip this interceptor by setting an @IgnoreJwt annotation to the controller ... Or is there another solution for this problem?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have the same problem. Are there any solution without spring security? Same version 2.9.2
I solved this by Spring security (this code is in kotlin but doesnt matter). Perhaps it might help you