ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 스프링부트_Swagger2
    Spring Boot 2019. 8. 29. 21:58

     

     

    src > main > webapp 

    webapp폴더가 없으면 추가를 해야한다.

     

     

    pom.xml 설정 

     

    <dependency>

        <groupId>io.springfox</groupId>

        <artifactId>springfox-swagger2</artifactId>

        <version>2.6.1</version>

    </dependency>

    <dependency>

        <groupId>io.springfox</groupId>

        <artifactId>springfox-swagger-ui</artifactId>

        <version>2.6.1</version>

    </dependency>

    <dependency>

        <groupId>com.google.guava</groupId>

        <artifactId>guava</artifactId>

        <version>25.1-jre</version>

    </dependency>

     

     

     

    SwaggerConfig.java

     

    @Configuration

    @EnableSwagger2

    public class SwaggerConfig extends WebMvcConfigurerAdapter {

        @Bean

        public Docket api() {

            return new Docket(DocumentationType.SWAGGER_2

              .select()                                 

              .apis(RequestHandlerSelectors.any())             

              .paths(PathSelectors.any())                         

              .build();                                          

        }

      

    }

     

     

     

    실행화면 : http://localhost:8080/swagger-ui.html

     

     

    'Spring Boot' 카테고리의 다른 글

    스프링 부트_mybatis(마이바티스)  (0) 2019.08.29
    스프링부트_파일 다운로드  (0) 2019.08.29
    스프링부트_톰캣 (war) 배포  (0) 2019.08.29
Designed by Tistory.