springboot配置swagger并修改默认地址

1. 添加swagger依赖,一定要高于2.6.1版本

//api
   compile ('io.springfox:springfox-swagger2:2.6.1') {
       exclude(module: 'slf4j-log4j12')
   }
   compile ('io.springfox:springfox-swagger-ui:2.6.1') {
       exclude(module: 'slf4j-log4j12')
   }
   compile ('com.github.xiaoymin:swagger-bootstrap-ui:1.9.6')

    apiCompile ('io.swagger:swagger-annotations:1.5.10') {
        exclude(module: 'slf4j-log4j12')
    }

2.请求拦截配置

package com.lie.config.springmvc;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@EnableWebMvc

版权声明:本文为weixin_44259233原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。