前缀的属性:swagger.prefix
静态资源通过ResourceHandler定义访问路径;接口则通过RedirectViewController重定向。
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author markix
*/
@Configuration
public class SwaggerPrefixConfiguration implements WebMvcConfigurer {
@Value(“${swagger.prefix:}”)
private String swaggerPrefix;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
if (isPrefixSet()) {
registry.addResourceHandler(swaggerPrefix &#