這篇文章將帶你了解如何用spring官方推薦的restdoc去生成api文檔。本文創(chuàng)建一個(gè)簡(jiǎn)單的springboot工程,將http接口通過Api文檔暴露出來。只需要通過 JUnit單元測(cè)試和Spring的MockMVC就可以生成文檔。
準(zhǔn)備工作
創(chuàng)建工程
引入依賴,其pom文件:
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.restdocs</groupId> <artifactId>spring-restdocs-mockmvc</artifactId> <scope>test</scope> </dependency> </dependencies>
分享名稱:詳解如何用springRestdocs創(chuàng)建API文檔-創(chuàng)新互聯(lián)
分享URL:http://jinyejixie.com/article18/dphpdp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器、電子商務(wù)、標(biāo)簽優(yōu)化、網(wǎng)站制作、網(wǎng)站營(yíng)銷、企業(yè)網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容