【发布时间】:2018-10-25 19:01:30
【问题描述】:
我使用swagger2。我将它配置为在使用访问根路径时重定向到swagger-ui.html。
@Bean
public WebMvcConfigurer index() {
return new WebMvcConfigurer() {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addRedirectViewController("/", "/swagger-ui.html");
}
};
}
正如我在 application.yml 中配置的 context-path 为 /api,现在当用户尝试访问 /api 时,他被重定向到 /api/swagger-ui.html。
但我根本不想显示swagger-ui.html,只留下/api。有没有办法做到这一点?
【问题讨论】: