티스토리 뷰

728x90
@Profile(value = {"swagger"})
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
    ...
}
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Profile;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Profile("!local")
@Controller
public class SwaggerUiController {
   @GetMapping(value = "swagger-ui.html")
   public ResponseEntity disable() {
      return new ResponseEntity<>(StringUtils.EMPTY, HttpStatus.NOT_FOUND);
   }
}

https://stackoverflow.com/questions/46454473/how-to-fully-disable-swagger-ui-in-spring-boot-swagger-ui-html-should-return-4/46458135#46458135

 

How to fully disable swagger-ui in spring-boot?(/swagger-ui.html should return 404)

I have read following topic: Disabling Swagger with Spring MVC and I wrote: @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(

stackoverflow.com

 

728x90
댓글
댓글쓰기 폼