Swagger 설정하기

Sol's·2023년 1월 1일

프로젝트

목록 보기
4/16

프로젝트 Dependecies에 아래내용 추가

implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: '3.0.0'
implementation 'io.springfox:springfox-boot-starter:3.0.0'

SwaggerConfiguration 추가

  • springfox-boot-starter를 추가해야Docket이 임포트 된다.
@Configuration
public class SwaggerConfiguration {
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.OAS_30)
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build();
    }
}

NullpointException 발생시 yml파일 변경

server:
  servlet:
    encoding:
      force-response: true
spring:
  jpa:
    hibernate:
      ddl-auto: update
    show-sql: true
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: localhost
    username: root
    password: 1q2w3e4r
---------------------추가--------------------------
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher
profile
배우고, 생각하고, 행동해라

0개의 댓글