๐Ÿฅ•
TIL
  • [TIL] Studying tech / computer science knowledge
  • KeyMap
  • ์•Œ๊ณ ๋ฆฌ์ฆ˜
    • ๋ณต์žก๋„ ๊ณ„์‚ฐ ( Computational Complexity )
    • DisjointSet-unionFind
    • Bellman-ford Algorithm
    • Dijkstra's Algorithm
    • DP ( Dynamic Programming , ๋™์  ๊ณ„ํš๋ฒ• )
    • ํ”Œ๋กœ์ด๋“œ-์›Œ์…œ ์•Œ๊ณ ๋ฆฌ์ฆ˜ (Floyd-Warshall algorithm)
    • Kruskal's Algorithm
    • ์ตœ์žฅ ์ฆ๊ฐ€ ์ˆ˜์—ด (Longes Increasing Subsequence)
    • Prim's Algorithm
    • ์ •๋ ฌ
    • ์‹œ๊ฐ„๋ณต์žก๋„ ์™€ ๊ณต๊ฐ„๋ณต์žก๋„ ( Time Complexity & Space Complexity )
    • Topological Sort (์œ„์ƒ ์ •๋ ฌ)
  • ์ฑ… ์ฝ๊ณ ๋‚œ ํ›„ ์š”์•ฝ
    • ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๋Œ€ํšŒ์—์„œ ๋ฐฐ์šฐ๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ฌธ์ œํ•ด๊ฒฐ ์ „๋žต
    • cleancode
    • ๋„๋ฉ”์ธ ์ฃผ๋„ ์„ค๊ณ„๋กœ ์‹œ์ž‘ํ•˜๋Š” ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค ๊ฐœ๋ฐœ
    • ์˜ค๋ธŒ์ ํŠธ
  • CDC
    • debzium
    • kafka
  • ๊ฐœ๋ฐœ ์ƒ์‹
    • asciidoctor
    • ์ปดํŒŒ์ผ๋Ÿฌ
    • ELK ์Šคํƒ
    • ์—”๋””์•ˆ
    • git
    • Gitmoji
    • ํ…Œ์ŠคํŠธ ์ข…๋ฅ˜
    • ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์™€ ํ”„๋ ˆ์ž„์›Œํฌ
    • ์ •๊ทœ ํ‘œํ˜„์‹
    • REST API
    • ๋™๊ธฐ์™€ ๋น„๋™๊ธฐ / Blocking๊ณผ NonBlocking
    • Transaction Script์™€ Domain Model
    • ๋””์ž์ธ ํŒจํ„ด
      • ํ–‰๋™ ํŒจํ„ด
      • ๊ฐ์ฒด ์ƒ์„ฑ ํŒจํ„ด
        • ์ถ”์ƒ ํŒฉํ† ๋ฆฌ ํŒจํ„ด
        • ๋นŒ๋” ํŒจํ„ด
        • ํŒฉํ† ๋ฆฌ ๋ฉ”์„œ๋“œ ํŒจํ„ด
        • [์ƒ์„ฑ ํŒจํ„ด] ํ”„๋กœํ†  ํƒ€์ž… (Prototype Parttern)
        • ์‹ฑ๊ธ€ํ†ค
      • ๊ตฌ์กฐ ํŒจํ„ด
        • ์–ด๋Œ‘ํ„ฐ ํŒจํ„ด
        • ๋ธŒ๋ฆฟ์ง€ ํŒจํ„ด
        • ์ปดํฌ์ง“(Composite) ํŒจํ„ด
        • ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ
        • ํ”„๋ก์‹œ
    • refactoring
      • ์ค‘๋ณต ์ฝ”๋“œ
      • ์ „์—ญ ๋ฐ์ดํ„ฐ
      • ๊ธด ํ•จ์ˆ˜
      • ๊ธด ๋งค๊ฐœ๋ณ€์ˆ˜ ๋ชฉ๋ก
      • ๊ฐ€๋ณ€ ๋ฐ์ดํ„ฐ
      • ์ดํ•ดํ•˜๊ธฐ ํž˜๋“  ์ด๋ฆ„
  • ์ž๋ฃŒ๊ตฌ์กฐ
    • AVL Tree
    • Splay Tree
    • aaTree
    • array-list
    • ์ž๋ฃŒ๊ตฌ์กฐ ์‹œ๊ฐ„/๊ณต๊ฐ„ ๋ณต์žก๋„
    • ๊ทธ๋ž˜ํ”„
    • ํž™
    • Red Black Tree
    • stack-queue
    • ํŠธ๋ฆฌ ( Tree )
  • DevOps
    • MSA
    • Kubernetes
      • AccessingAPI
      • controller
      • dashboard
      • kubernetes
      • object
      • pod
      • service
      • volume
  • Java
    • ์–ด๋…ธํ…Œ์ด์…˜
    • ์ œ์–ด๋ฌธ
    • ๋ฐ์ดํ„ฐ ํƒ€์ž…
    • Enum
    • jvm
    • ์—ฐ์‚ฐ์ž
    • thread
    • Java8
      • CompletableFuture
      • Date/Time
      • ์–ด๋…ธํ…Œ์ด์…˜๊ณผ ๋ฉ”ํƒ€์ŠคํŽ˜์ด์Šค
      • ์ธํ„ฐํŽ˜์ด์Šค
      • ๋žŒ๋‹ค์‹
      • Optional
      • ์ŠคํŠธ๋ฆผ
  • JavaScript
    • moduleProject
    • webpack-babel
    • ์ฝ”์–ด ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ
      • array
      • ํ•จ์ˆ˜ ๋ฐ”์ธ๋”ฉ
      • ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ์™€ ํฌ์›Œ๋”ฉ
      • Class
      • ๋น„๊ต ์—ฐ์‚ฐ์ž
      • Date ๋‚ด์žฅ ๊ฐ์ฒด
      • destructuring-assignment
      • function
      • ํ•จ์ˆ˜์˜ prototype ํ”„๋กœํผํ‹ฐ
      • ๊ฐ€๋น„์ง€ ์ปฌ๋ ‰์…˜ ( Garbage Collection )
      • JSON (JavaScript Object Notation)
      • map-set
      • ๋‚ด์žฅ ํ”„๋กœํ† ํƒ€์ž…
      • new์—ฐ์‚ฐ์ž์™€ ์ƒ์„ฑ์ž ํ•จ์ˆ˜
      • ๊ฐ์ฒด
      • Object.keys, values, entries
      • ์˜ต์…”๋„ ์ฒด์ด๋‹ '?.'
      • ํ”„๋กœํผํ‹ฐ ํ”Œ๋ž˜๊ทธ
      • ํ”„๋กœํผํ‹ฐ ์ข…๋ฅ˜
      • ํ”„๋กœํ†  ํƒ€์ž…
      • ํ˜ธ์ถœ ์Šค์ผ€์ค„๋ง ( scheduling a call )
      • scope
      • this
      • type-conversions
      • type
      • ํ•จ์ˆ˜์˜ ์ž๋ฃŒํ˜•
      • var_let_const
  • Linux
    • ๊ธฐ๋ณธ ๋ช…๋ น์–ด
    • ํŒŒ์ผ ์ข…๋ฅ˜
    • ๋ฆฌ๋ˆ…์Šค
  • ๋„คํŠธ์›Œํฌ
    • ์‘์šฉ ๊ณ„์ธต ( Application Layer )
    • ์˜ค๋ฅ˜ ๊ฒ€์ถœ๊ณผ ์˜ค๋ฅ˜ ์ •์ •
    • Http
    • Http Header
    • ์ปดํ“จํ„ฐ ๋„คํŠธ์›Œํฌ๋ž€
    • ๋„คํŠธ์›Œํฌ ๊ณ„์ธต
    • ๋„คํŠธ์›Œํฌ ์ œ์–ด ์˜์—ญ
    • ์ „์†ก ๊ณ„์ธต ( Transport Layer )
  • PHP
    • Facade
    • composer
    • scopeResolutionOperator
    • Laravel
      • SocialProvider
      • architecture
      • blade
      • controller
      • db
      • dbArchitecture
      • debug
      • eloquent
      • email
      • event
      • exceptionHandling
      • middleware
      • model
      • modelFactory
      • pagingLoading
      • queryBuilder
      • route
      • scout
      • seeding
      • tntsearch
      • validate
      • view
  • React
    • Next.js
    • React ๋ž€?
  • Spring
    • Controller
    • ์š”์ฒญ์ด ๋“ค์–ด์™”์„๋•Œ ์Šคํ”„๋ง์ด ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ๋ฒ• ( ๋‚ด๋ถ€๊ตฌ์กฐ )
    • ConfigurationProperties
    • Entity / DTO / VO
    • Maven
    • Repository์™€ DAO
    • ์Šคํ”„๋ง ๋นˆ
    • Spring Framework
    • MVC ํŒจํ„ด
    • ๋„๋ฉ”์ธ ์ž…๋ ฅ๊ฐ’ ๊ฒ€์ฆ
    • Spring Cloud
      • Spring Cloud
      • Eureka
    • Spring Data
      • JPA
      • JPA ์–ด๋…ธํ…Œ์ด์…˜
      • ์—”ํ‹ฐํ‹ฐ ๋น„๊ต
      • ๋ณตํ•ฉ ํ‚ค์™€ ์‹๋ณ„ ๊ด€๊ณ„ ๋งคํ•‘
      • JPA ์˜ˆ์™ธ์ฒ˜๋ฆฌ
      • ๊ฐ์ฒด์ง€ํ–ฅ ์ฟผ๋ฆฌ
      • EntityManagerFactory์™€ EntityManager
      • JPA ์ตœ์ ํ™”
      • ํ”„๋ก์‹œ์™€ ์—ฐ๊ด€๊ด€๊ณ„ ๋งตํ•‘
      • ์—ฐ๊ด€๊ด€๊ณ„
      • ์ƒ์†๊ด€๊ณ„ ๋งตํ•‘
      • ํŠธ๋žœ์žญ์…˜ ๋ฒ”์œ„์™€ ์˜์†์„ฑ ์ปจํ…์ŠคํŠธ
      • ๋ฐ์ดํ„ฐ ํƒ€์ž…
      • MySQL ์—ฐ๊ฒฐ
      • Pageable
    • Spring Project๋“ค๊ณผ library
      • Custom Serialize
      • Elasticsearch Index API
      • Spring HATEOAS
      • lombok (๋กฌ๋ณต)
      • Model Mapper
      • Object Mapper
      • Representation Model
      • Spring REST Docs
      • Spring Boot
    • Spring Security
      • Spring Security
      • Authentication
      • Authentication Filter
      • Authorization Filter
      • Filter Chain
      • SecurityContext
      • Spring OAuth2.0
    • Spring Test
      • AssertJ
      • Junit5
      • JunitParams
      • Mock Object
  • DataBase
    • ALIAS
    • CONCAT
    • CTE
    • Group By
    • HAVING
    • IFNULL
    • ์ธ๋ฑ์Šค
    • JOIN
    • ORDER BY
    • ROLLUP
    • SELECT
    • SELECT DISTINCT
    • SQL
    • WHERE
  • Web ์ƒ์‹
    • OAuth
    • WAS
    • HTTPํ†ต์‹  ๊ธฐ๋ฐ˜ ์ธ์ฆ
    • ๋ธŒ๋ผ์šฐ์ €
    • CSR ๊ณผ SSR
    • HTTPS
    • Web
Powered by GitBook
On this page
  • Swagger์™€์˜ ์ฐจ์ด์ 
  • ์‚ฌ์šฉ๋ฒ•
  • ๋ฉ”์„œ๋“œ
  • Customize
  • build
  • Reference
  1. Spring
  2. Spring Project๋“ค๊ณผ library

Spring REST Docs

Spring MVC Test๋ฅผ ์ด์šฉํ•ด์„œ REST API ๋ฌธ์„œ์˜ ์กฐ๊ฐ(snippets)์„ ์ƒ์„ฑํ•˜๋Š”๋ฐ ๋„์›€์„ ์ฃผ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ

๊ธฐ๋ณธ์ ์œผ๋กœ Asciidoctor๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ htmlํŒŒ์ผ์„ ์ƒ์„ฑํ•˜๊ณ , ์›ํ•˜๋Š” ๊ฒฝ์šฐ Markdown์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

API๋ฅผ ์ •์˜ํ•˜๋Š”๋ฐ ์‚ฌ์šฉํ•˜๋Š” ๋‹ค๋ฅธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” Swagger๊ฐ€ ์žˆ๋‹ค.

Swagger์™€์˜ ์ฐจ์ด์ 

Swagger๋Š” API๋ฅผ ํ…Œ์ŠคํŠธ ํ•ด๋ณผ ์ˆ˜ ์žˆ๋Š” ํ™”๋ฉด์„ ์ œ๊ณตํ•˜๊ณ  ์‹ค์ œ ์ฝ”๋“œ์— ์–ด๋…ธํ…Œ์ด์…˜์„ ์ถ”๊ฐ€ํ•ด์•ผํ•˜์ง€๋งŒ Spring Rest Docs๋Š” ํ…Œ์ŠคํŠธ์ฝ”๋“œ๋ฅผ ํ†ตํ•ด ์ƒ์„ฑ๋˜๋ฏ€๋กœ ์‹ค์ œ์ฝ”๋“œ์—๋Š” ์˜ํ–ฅ์ด ์—†๋‹ค.

์‚ฌ์šฉ๋ฒ•

  • MockMvc, WebTestClient๋“ฑ์— ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•˜๋ฉฐ test์— ์‚ฌ์šฉํ•˜๋Š” mockMvc๋ฅผ ๋งŒ๋“ค๋•Œ documentationConfiguration์„ ์‚ฌ์šฉํ•˜์—ฌ ์ƒ์„ฑํ•˜๊ณ  MockMvc๋กœ ํ…Œ์ŠคํŠธ ์ค‘ andDo๋ฅผ ์ด์šฉํ•˜์—ฌ ์ƒ์„ฑ

  • Spring Boot์—์„œ๋Š” ๊ฐ„๋‹จํžˆ @AutoConfigureRestDocs๋งŒ ๋ถ™์—ฌ์ฃผ๋ฉด ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

Test๋‚ด์šฉ์ด ๋ฐ”๋€Œ๊ฑฐ๋‚˜ ๋‹ค์‹œ ์‹คํ–‰ํ• ๋•Œ๋งˆ๋‹ค Overrideํ•˜์—ฌ ๋ฌธ์„œ๊ฐ€ ๋‹ค์‹œ ์ž‘์„ฑ๋œ๋‹ค.

๋ฉ”์„œ๋“œ

  • andDo(document(โ€œdoc-nameโ€, snippets))

    • snippets

      • links()

      • requestParameters() + parameterWithName()

      • pathParameters() + parametersWithName()

      • requestParts() + partWithname()

      • requestPartBody()

      • requestPartFields()

      • requestHeaders() + headerWithName()

      • requestFields() + fieldWithPath()

      • responseHeaders() + headerWithName()

      • responseFields() + fieldWithPath()

      • ...

        this.mockMvc.perform(post("/api/events")
                    .contentType(MediaType.APPLICATION_JSON)
                    .accept(MediaTypes.HAL_JSON)
                    .content(this.objectMapper.writeValueAsString(event)))
                .andDo(print())
                .andExpect(status().isCreated())
                .andExpect(jsonPath("id").exists())
                .andExpect(header().exists(HttpHeaders.LOCATION))
                .andExpect(header().string(HttpHeaders.CONTENT_TYPE,"application/hal+json;charset=UTF-8"))
                .andExpect(jsonPath("free").value(false))
                .andExpect(jsonPath("offline").value(true))
                .andExpect(jsonPath("eventStatus").value(EventStatus.DRAFT.name()))
                .andExpect(jsonPath("_links.self").exists())
                .andExpect(jsonPath("_links.query-events").exists())
                .andExpect(jsonPath("_links.update-event").exists())
                .andDo(document("create-event",
                        links(
                             linkWithRel("self").description("link to self"),
                             linkWithRel("query-events").description("link to query-events"),
                             linkWithRel("update-event").description("link to update-event")
                        ),
                        requestHeaders(
                                headerWithName(HttpHeaders.ACCEPT).description("accept header"),
                                headerWithName(HttpHeaders.CONTENT_TYPE).description("content type header")
                        ),
                        requestFields(
                            fieldWithPath("name").description("Name of Event"),
                            fieldWithPath("description").description("Description of Event"),
                            fieldWithPath("beginEnrollmentDateTime").description("๋“ฑ๋ก์‹œ์ž‘๊ธฐ๊ฐ„ of Event"),
                            fieldWithPath("closeEnrollmentDateTime").description("๋“ฑ๋ก๋งˆ๊ฐ๊ธฐ๊ฐ„ of Event"),
                            fieldWithPath("beginEventDateTime").description("์‹œ์ž‘๊ธฐ๊ฐ„ of Event"),
                            fieldWithPath("endEventDateTime").description("์ข…๋ฃŒ๊ธฐ๊ฐ„ of Event"),
                            fieldWithPath("location").description("location of Event"),
                            fieldWithPath("basePrice").description("BasePrice of Event"),
                            fieldWithPath("maxPrice").description("MaxPrice of Event"),
                            fieldWithPath("limitOfEnrollment").description("๋“ฑ๋ก ์ œํ•œ of Event")
                        )
                        ,responseHeaders(
                                headerWithName(HttpHeaders.LOCATION).description("location header"),
                                headerWithName(HttpHeaders.CONTENT_TYPE).description("content type header")
                        ),
                        responseFields(
                                fieldWithPath("id").description("identifier of Event"),
                                fieldWithPath("name").description("Name of Event"),
                                fieldWithPath("description").description("Description of Event"),
                                fieldWithPath("beginEnrollmentDateTime").description("๋“ฑ๋ก์‹œ์ž‘๊ธฐ๊ฐ„ of Event"),
                                fieldWithPath("closeEnrollmentDateTime").description("๋“ฑ๋ก๋งˆ๊ฐ๊ธฐ๊ฐ„ of Event"),
                                fieldWithPath("beginEventDateTime").description("์‹œ์ž‘๊ธฐ๊ฐ„ of Event"),
                                fieldWithPath("endEventDateTime").description("์ข…๋ฃŒ๊ธฐ๊ฐ„ of Event"),
                                fieldWithPath("location").description("location of Event"),
                                fieldWithPath("basePrice").description("BasePrice of Event"),
                                fieldWithPath("maxPrice").description("MaxPrice of Event"),
                                fieldWithPath("limitOfEnrollment").description("๋“ฑ๋ก ์ œํ•œ of Event"),
                                fieldWithPath("offline").description("์˜คํ”„๋ผ์ธ์ธ์ง€ of Event"),
                                fieldWithPath("free").description("๋ฌด๋ฃŒ์ธ์ง€ of Event"),
                                fieldWithPath("eventStatus").description("eventStatus of Event"),
                                fieldWithPath("_links.self.href").description("link to self"),
                                fieldWithPath("_links.query-events.href").description("link to query-events"),
                                fieldWithPath("_links.update-event.href").description("link to update-event")
                        )
                        ));
  • Relaxed* : ๋ชจ๋“  ํ•„๋“œ์— ๋Œ€ํ•ด ๊ธฐ์ˆ  ํ•˜์ง€ ์•Š์•„๋„ ๋ฌธ์„œํ™”๋ฅผ ์‹œ์ผœ์ฃผ๊ธฐ ์œ„ํ•œ prefix

    ๋ฌธ์„œ ์ผ๋ถ€๋ถ„๋งŒ ํ…Œ์ŠคํŠธ ํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ์žฅ์ ์ด ์žˆ์ง€๋งŒ, ์ •ํ™•ํ•œ ๋ฌธ์„œํ™”๊ฐ€ ๋ถˆ๊ฐ€๋Šฅ ํ•˜๋‹ค.

  • Processor

    • preprocessRequest(prettyPrint())

    • preprocessResponse(prettyPrint())

      configurer.operationPreprocessors().withRequestDefaults(prettyPrint()).withResponseDefaults(prettyPrint());

Customize

jsonํ˜•ํƒœ๋ฅผ ํ•œ์ค„๋กœ ํฌ๋งทํŒ…ํ•˜์ง€ ์•Š์€ ์ฑ„๋กœ responseํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ณด๊ธฐ๊ฐ€ ๋งค์šฐ ๋ถˆํŽธํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ณด๊ธฐ ํŽธํ•˜๊ฒŒ foramattingํ•˜์—ฌ ์ถœ๋ ฅํ•˜๊ฒŒ RestDocksMockMvcConfigurationCustomizer ๊ตฌํ˜„ํ•œ ๋นˆ์„ ๋“ฑ๋ก(๋‚ด๋ถ€์— prettyPrint ์ด์šฉ)ํ•˜์—ฌ ์‚ฌ์šฉํ•˜๊ณ  Testํด๋ž˜์Šค์— @Import(RestDocsConfiguration.class)์„ ํ†ตํ•ด ์ƒ์„ฑํ•œ ์ปค์Šคํ…€ ์„ค์ •์„ ์ ์šฉํ•ด์•ผ ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

@TestConfiguration //Test์—๋งŒ ์‚ฌ์šฉํ•˜๋Š” configuration์ด๋‹ค.
public class RestDocsConfiguration {

    @Bean
    public RestDocsMockMvcConfigurationCustomizer restDocsMockMvcConfigurationCustomizer(){
        return new RestDocsMockMvcConfigurationCustomizer() {
            @Override
            public void customize(MockMvcRestDocumentationConfigurer configurer) {
                configurer.operationPreprocessors()
                        .withRequestDefaults(prettyPrint())
                        .withResponseDefaults(prettyPrint());
            }
        }
    }
}
//replace๊ธฐ๋Šฅ ์ด์šฉํ•˜์—ฌ ๋žŒ๋‹ค๋กœ ๋ฐ”๊พธ๋ฉด
@TestConfiguration
public class RestDocsConfiguration {

    @Bean
    public RestDocsMockMvcConfigurationCustomizer restDocsMockMvcConfigurationCustomizer(){
        return configurer -> configurer.operationPreprocessors().withRequestDefaults(prettyPrint())
                .withResponseDefaults(prettyPrint());
    }
}

build

  • buildํ•˜๊ธฐ ์œ„ํ•ด dependecny ์ถ”๊ฐ€

<plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>1.5.8</version>
                <executions>
                    <execution>
                        <id>generate-docs</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>html</backend>
                            <doctype>book</doctype>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.springframework.restdocs</groupId>
                        <artifactId>spring-restdocs-asciidoctor</artifactId>
                        <version>2.0.5.RELEASE</version>
                    </dependency>
                </dependencies>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.7</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>
                                ${project.build.outputDirectory}/static/docs
                            </outputDirectory>
                            <resources>
                                <resource>
                                    <directory>
                                        ${project.build.directory}/generated-docs
                                    </directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
  • mainํŒจํ‚ค์ง€ ์•„๋ž˜ asciidoc ํด๋”๋ฅผ ๋งŒ๋“ค์–ด index.adocํŒŒ์ผ ์ƒ์„ฑ

  • maven์˜ package๋กœ build

    ๋นŒ๋“œํ•˜๋ฉด asciidoctor-maven-plugin์ด asciidocํŒŒ์ผ์„ html๋กœ ๋งŒ๋“ค์–ด genreated-docs ์•„๋ž˜ index.html์ด ์ƒ์„ฑ๋œ๋‹ค.

    maven-resources-plugin์— ๋”ฐ๋ผ build๋œ generated-docs์— ์ƒ์„ฑํ•œ ํŒŒ์ผ์„ build์˜ staticํŒŒ์ผ ์•„๋ž˜ ์ƒ์„ฑํ•ด์คŒ์œผ๋กœ์จ spring bootํŠน์„ฑ์„ ์ด์šฉํ•ด ์„œ๋ฒ„์‹คํ–‰์‹œ url๋กœ ์ ‘๊ทผ์ด ๊ฐ€๋Šฅํ•˜๋‹ค.


Reference

https://docs.spring.io/spring-restdocs/docs/2.0.5.RELEASE/reference/html5/

https://narusas.github.io/2018/03/21/Asciidoc-basic.html

PreviousRepresentation ModelNextSpring Boot

Last updated 3 years ago