| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cloud.gateway.config.GatewayProperties; |
| | | import org.springframework.cloud.gateway.route.RouteLocator; |
| | |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class SwaggerProvider implements SwaggerResourcesProvider, WebFluxConfigurer |
| | | { |
| | | public class SwaggerProvider implements SwaggerResourcesProvider, WebFluxConfigurer { |
| | | /** |
| | | * Swagger2默认的url后缀 |
| | | */ |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<SwaggerResource> get() |
| | | { |
| | | public List<SwaggerResource> get() { |
| | | List<SwaggerResource> resourceList = new ArrayList<>(); |
| | | List<String> routes = new ArrayList<>(); |
| | | // 获取网关中配置的route |
| | |
| | | return resourceList; |
| | | } |
| | | |
| | | private SwaggerResource swaggerResource(String name, String location) |
| | | { |
| | | private SwaggerResource swaggerResource(String name, String location) { |
| | | SwaggerResource swaggerResource = new SwaggerResource(); |
| | | swaggerResource.setName(name); |
| | | swaggerResource.setLocation(location); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void addResourceHandlers(ResourceHandlerRegistry registry) |
| | | { |
| | | public void addResourceHandlers(ResourceHandlerRegistry registry) { |
| | | /** swagger-ui 地址 */ |
| | | registry.addResourceHandler("/swagger-ui/**","*/doc.html") |
| | | .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/"); |