1.引入依赖,版本3.0.0只引入一个即可
<dependency> <groupId>io.springfox</groupId> <artifactId>springfox-boot-starter</artifactId> <version>3.0.0</version> </dependency>
2. 配置类SwaggerConfig
package org.fh.config;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import springfox.documentation.builders.ApiInfoBuilder;import springfox.documentation.builders.PathSelectors;import springfox.documentation.builders.RequestHandlerSelectors;import springfox.documentation.oas.annotations.EnableOpenApi;import springfox.documentation.service.ApiInfo;import springfox.documentation.spi.DocumentationType;import springfox.documentation.spring.web.plugins.Docket;/** * 说明:Swagger 接口API生成 * 作者:FH Admin * from fhadmin.cn */@Configuration@EnableOpenApipublic class SwaggerConfig { @Bean public Docket createRestApi() { return new Docket(DocumentationType.OAS_30) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("org.fh.controller")) // 为当前包路径 .paths(PathSelectors.any()) .build(); } private ApiInfo apiInfo() { return new ApiInfoBuilder() .title("FH Admin Swagger3 RESTful API") // 页面标题 .version("3.0") // 版本号 .description("fhadmin.org") // 描述 .build(); }}
3.Swagger 拦截配置
package org.fh.config;import org.springframework.context.annotation.Configuration;import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;/** * 说明:Swagger 拦截配置 * 作者:FH Admin * from fhadmin.cn */@Configurationpublic class WebMvcConfig implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry. addResourceHandler("/swagger-ui/**") .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/") .resourceChain(false); } @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/swagger-ui/") .setViewName("forward:/swagger-ui/index.html"); }}4.访问 127.0.0.1:8081/swagger-ui/......原文转载:http://www.shaoqun.com/a/836184.html
跨境电商:https://www.ikjzd.com/
识货:https://www.ikjzd.com/w/1745
etoro:https://www.ikjzd.com/w/1402
unsplash:https://www.ikjzd.com/w/756.html
1.引入依赖,版本3.0.0只引入一个即可<dependency><groupId>io.springfox</groupId><artifactId>springfox-boot-starter</artifactId><version>3.0.0</version></dependency>2.配置
patents:https://www.ikjzd.com/w/857
亚马逊用这种手法优化Listing增加产品竞争力:https://www.ikjzd.com/articles/96745
亚马逊撰写产品listing必经的三大阶段,你还在哪一段停留?:https://www.ikjzd.com/articles/96746
5.25封号后续:已有卖家救回账号!:https://www.ikjzd.com/articles/96748
自建站推广和平台推广,哪种更有效? :https://www.ikjzd.com/articles/96750
口述:我和小姨子有了性关系:http://lady.shaoqun.com/a/77111.html
口述:与准嫂子销魂一夜她怀上我的孩子:http://lady.shaoqun.com/a/38671.html
寂寞漂亮少妇与农民工在电梯里(5/5):http://lady.shaoqun.com/m/a/46563.html
2021深圳国际酒展延期举办(最新时间):http://www.30bags.com/a/462643.html
2021深圳春季茶博会延期举办(最新时间):http://www.30bags.com/a/462644.html
在四川乐山女子公园被抢劫杀害的凶手被一审判处死刑:http://lady.shaoqun.com/a/391625.html
女方晚上走了,失去联系6天。还是没有消息。强奸和谋杀被拘留了5天:http://lady.shaoqun.com/a/391626.html
没有评论:
发表评论