wamp网站建设,江苏新站优化,营销型网站建设方面的书,wordpress网站音乐放不全目录 1. pom.xml文件中添加Swagger的jar包
2. 配置Swagger
3. 项目启动中加入Swagger注解的开关#xff0c;启动Swagger功能
4. 启动项目#xff0c;查看效果 Swagger 的功能这里就不多说明了#xff0c;相信大家都懂的#xff0c;好奇多问一句#xff0c;大家有知道其…目录 1. pom.xml文件中添加Swagger的jar包
2. 配置Swagger
3. 项目启动中加入Swagger注解的开关启动Swagger功能
4. 启动项目查看效果 Swagger 的功能这里就不多说明了相信大家都懂的好奇多问一句大家有知道其他类似Swagger的替代品吗欢迎留言一起交流 只需要三步快速启用Swagger功能让你的项目实现Swagger在线文档实时浏览修改展示 1. pom.xml文件中添加Swagger的jar包
2. 配置Swagger
3. 项目启动中加入Swagger注解的开关启动Swagger功能 具体如下
1. pom.xml文件中添加Swagger的jar包
我这里使用的spring boot是2.1.4的版本 parentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion2.1.4.RELEASE/version/parent
Swagger 依赖 !-- swagger --dependencygroupIdio.springfox/groupIdartifactIdspringfox-swagger2/artifactIdversion2.9.1/version/dependency!-- swagger-ui --dependencygroupIdio.springfox/groupIdartifactIdspringfox-swagger-ui/artifactIdversion2.10.0/version/dependency!-- 解决 Illegal DefaultValue null for parameter type integer 异常 --dependencygroupIdio.swagger/groupIdartifactIdswagger-annotations/artifactIdversion1.5.21/version/dependencydependencygroupIdio.swagger/groupIdartifactIdswagger-models/artifactIdversion1.5.21/version/dependency 2. 配置Swagger Configuration
EnableSwagger2
public class Swagger2 {Beanpublic Docket createRestApi() {return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.basePackage(com.gcc.account)).paths(PathSelectors.any()).build();}private ApiInfo apiInfo() {return new ApiInfoBuilder().title(GCC Account API).contact(new Contact(gcc, , )).version(1.0).description(API描述).build();}
}3. 项目启动中加入Swagger注解的开关启动Swagger功能
SpringBootApplication(exclude {DataSourceAutoConfiguration.class
})
EnableSwagger2
public class AccountApplication {public static void main(String[] args) {SpringApplication.run(AccountApplication.class, args);}} 4. 启动项目查看效果
访问地址 http://localhost:8011/gccaccount/swagger-ui.html#/