WIP
This commit is contained in:
@@ -6,6 +6,10 @@ dependencies {
|
|||||||
|
|
||||||
annotationProcessor('org.springframework.boot:spring-boot-configuration-processor')
|
annotationProcessor('org.springframework.boot:spring-boot-configuration-processor')
|
||||||
implementation('org.springframework.boot:spring-boot-starter-web')
|
implementation('org.springframework.boot:spring-boot-starter-web')
|
||||||
|
|
||||||
|
implementation(group: 'io.swagger', name: 'swagger-annotations', version: '1.5.21')
|
||||||
|
implementation(group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2')
|
||||||
|
implementation(group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2')
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named('compileJava') {
|
tasks.named('compileJava') {
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package ru.di9.mirror.web.config;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
|
import springfox.documentation.builders.PathSelectors;
|
||||||
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
|
import springfox.documentation.spi.DocumentationType;
|
||||||
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableSwagger2
|
||||||
|
@EnableWebMvc
|
||||||
|
public class SwaggerConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Docket api() {
|
||||||
|
return new Docket(DocumentationType.SWAGGER_2)
|
||||||
|
.select()
|
||||||
|
.apis(RequestHandlerSelectors.any())
|
||||||
|
.paths(PathSelectors.any())
|
||||||
|
.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package ru.di9.mirror.web.controller;
|
package ru.di9.mirror.web.controller;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.core.io.InputStreamResource;
|
import org.springframework.core.io.InputStreamResource;
|
||||||
@@ -23,6 +25,7 @@ import java.util.Optional;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping(path = "/maven")
|
@RequestMapping(path = "/maven")
|
||||||
|
@Api("API:DOCS")
|
||||||
public class MavenController {
|
public class MavenController {
|
||||||
private final StorageService storageService;
|
private final StorageService storageService;
|
||||||
|
|
||||||
@@ -30,6 +33,7 @@ public class MavenController {
|
|||||||
this.storageService = storageService;
|
this.storageService = storageService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("get file")
|
||||||
@GetMapping(path = "/{*path}")
|
@GetMapping(path = "/{*path}")
|
||||||
public ResponseEntity<Resource> mavenGetFile(@PathVariable("path") String httpPath) {
|
public ResponseEntity<Resource> mavenGetFile(@PathVariable("path") String httpPath) {
|
||||||
ResponseEntity<Resource> responseEntity;
|
ResponseEntity<Resource> responseEntity;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ server:
|
|||||||
address: 127.0.0.1
|
address: 127.0.0.1
|
||||||
port: 8080
|
port: 8080
|
||||||
|
|
||||||
debug: false
|
debug: true
|
||||||
|
|
||||||
maven:
|
maven:
|
||||||
storage: './storage'
|
storage: './storage'
|
||||||
|
|||||||
Reference in New Issue
Block a user