Swagger 적용

홍성일·2023년 2월 23일
0

RESTful API

목록 보기
2/3
  • pom.xml 추가
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>3.0.0</version>
        </dependency>
  • 에러 발생 시
    Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
//application.yml 파일을 다음과 같이 수정
spring:
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher
@Configuration
@EnableSwagger2
public class SwaggerConfig{
    @Bean
    public Docket api(){
        return new Docket(DocumentationType.SWAGGER_2);
    }
}

http://localhost:8088/v2/api-docs 화면

http://localhost:8088/swagger-ui/index.html 화면

profile
홍성일

0개의 댓글