| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | |
| | | * Knife4j配置类 |
| | | * |
| | | * @author WWW |
| | | * @date 2024-07-16 |
| | | * @date 2024-09-12 |
| | | */ |
| | | @Configuration |
| | | @EnableKnife4j |
| | | public class Knife4jConfig { |
| | | public class Knife4jConfig extends WebMvcConfigurationSupport { |
| | | @Value("${server.port}") |
| | | String serverPort; |
| | | |
| | |
| | | |
| | | @Value("${server.servlet.context-path}") |
| | | String contextPath; |
| | | |
| | | @Override |
| | | public void addResourceHandlers(ResourceHandlerRegistry registry) { |
| | | registry.addResourceHandler("doc.html") |
| | | .addResourceLocations("classpath:/META-INF/resources/"); |
| | | |
| | | registry.addResourceHandler("swagger-ui.html") |
| | | .addResourceLocations("classpath:/META-INF/resources/"); |
| | | registry.addResourceHandler("/webjars/**") |
| | | .addResourceLocations("classpath:/META-INF/resources/webjars/"); |
| | | } |
| | | |
| | | @Bean |
| | | public Docket createRestApi() { |
| | |
| | | //描述字段支持Markdown语法 |
| | | .description("接口文档") |
| | | .contact(new Contact("WuWeiwei", "http://127.0.0.1:" + serverPort + contextPath + "/doc.html", "252740454@qq.com")) |
| | | .version("1.0.0") |
| | | .title("内涝仿真渲染服务API接口文档") |
| | | .version("0.2") |
| | | .title("内涝仿真服务服务接口文档") |
| | | .build(); |
| | | } |
| | | } |