Spring Boot : Spring Doc

๊น€์•„๋ฌด๊ฐœยท2023๋…„ 7์›” 17์ผ
0

Spring Boot ๐Ÿƒ

๋ชฉ๋ก ๋ณด๊ธฐ
51/95

Spring Boot v2.*

์ตœ์‹  ๋ฒ„์ „ ํ™•์ธ์„ ์œ„ํ•œ ๊ณต์‹๋ฌธ์„œ ๋งํฌ

gradle

implementation "org.springdoc:springdoc-openapi-ui:1.7.0"

// spring-boot-starter-data-rest ์‚ฌ์šฉ์‹œ ์ถ”๊ฐ€
implementation "org.springdoc:springdoc-openapi-data-rest:1.7.0"

maven

<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-ui</artifactId>
    <version>1.7.0</version>
</dependency>

<!-- spring-boot-starter-data-rest ์‚ฌ์šฉ์‹œ ์ถ”๊ฐ€ -->
<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-data-rest</artifactId>
    <version>1.7.0</version>
</dependency>

์‹œํ๋ฆฌํ‹ฐ ์ธ์ฆ ํ•˜์ง€ ์•Š์„ ๋ฆฌ์†Œ์Šค ๋“ฑ๋ก

httpSecurity
    .requestMatchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()
    .mvcMatchers(
             "/v3/api-docs/**",
             "/swagger-ui/**",
             "/swagger-ui.html"
    ).permitAll()

Spring Boot v3.*

์ตœ์‹  ๋ฒ„์ „ ํ™•์ธ์„ ์œ„ํ•œ ๊ณต์‹๋ฌธ์„œ ๋งํฌ

gradle

implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0"

maven

<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
    <version>2.1.0</version>
</dependency>

์‹œํ๋ฆฌํ‹ฐ ์ธ์ฆ ํ•˜์ง€ ์•Š์„ ๋ฆฌ์†Œ์Šค ๋“ฑ๋ก

 httpSecurity
     .authorizeHttpRequests(
             auth -> auth
                .requestMatchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()
                .requestMatchers(
                       "/v3/api-docs/**",
                       "/swagger-ui/**",
                       "/swagger-ui.html"
                ).permitAll()
      )

์‹คํ–‰ ๊ฒฝ๋กœ

http://localhost:8080/swagger-ui/index.html
http://localhost:8080/v3/api-docs


springDoc custom

https://colabear754.tistory.com/99

0๊ฐœ์˜ ๋Œ“๊ธ€