hengboy / spring-cloud-chapter

Spring Cloud Enterprise Core Technology, Corresponding to the Special Subject Source of the Brief Book "Spring Cloud Core Technology"
14 stars 6 forks source link

Spring Boot中使用Swagger2构建强大的RESTful API文档 - 恒宇少年 #124

Open hengboy opened 5 years ago

hengboy commented 5 years ago

http://blog.yuqiyu.com/use-swagger2-build-restful-api.html

由于Spring Boot能够快速开发、便捷部署等特性,相信有很大一部分Spring Boot的用户会用来构建RESTful API。而我们构建RESTful API的目的通常都是由于多终端的原因,这些终端会共用很多底层业务逻辑,因此我们会抽象出这样一层来同时服务于多个移动端或者Web前端。

keepmovinglt commented 5 years ago

类上也可以添加注解将不同的接口放到同一个标签下@Api(tags = {"分类名称"}) 把访问路径暴露出去 registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");