当前位置: 首页 > wzjs >正文

手机怎么做黑网站网站域名查询地址

手机怎么做黑网站,网站域名查询地址,设计坞,医药销售网站开发背景以下是 Springfox Swagger 的完整配置及同类框架对比的详细说明&#xff1a; 一、Springfox Swagger 配置详解 1. 添加依赖 在 pom.xml 中添加以下依赖&#xff1a; <!-- Springfox Swagger 2 --> <dependency><groupId>io.springfox</groupId>…

以下是 Springfox + Swagger 的完整配置及同类框架对比的详细说明:
在这里插入图片描述
在这里插入图片描述


一、Springfox + Swagger 配置详解

1. 添加依赖

pom.xml 中添加以下依赖:

<!-- Springfox Swagger 2 -->
<dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><version>3.0.0</version> <!-- 注意版本兼容性 -->
</dependency>
<dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger-ui</artifactId><version>3.0.0</version>
</dependency>

2. 配置类(SwaggerConfig.java)
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.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;@Configuration
@EnableSwagger2
public class SwaggerConfig {@Beanpublic Docket createRestApi() {return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()// 指定Controller包路径.apis(RequestHandlerSelectors.basePackage("com.example.demo.controller"))// 指定路径(可选,PathSelectors.any() 表示所有路径).paths(PathSelectors.ant("/api/**")).build();}private ApiInfo apiInfo() {return new ApiInfoBuilder().title("API文档").description("系统接口文档").version("1.0.0").contact(new Contact("开发者", "https://example.com", "dev@example.com")).license("Apache 2.0").licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html").build();}
}

3. 自定义访问地址

通过修改 application.propertiesapplication.yml 自定义 Swagger UI 的访问路径:

# application.properties
springfox.documentation.swagger.v2.path=/custom-api-docs
springfox.documentation.swagger-ui.path=/custom-swagger-ui

访问地址变为:
http://localhost:8080/custom-swagger-ui


4. Controller 示例
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
@RequestMapping("/api")
@Api(tags = "示例接口") // 接口分组标签
public class ExampleController {@GetMapping("/hello")@ApiOperation("Hello接口")public String sayHello() {return "Hello, Swagger!";}
}

二、同类框架对比

1. Springdoc OpenAPI
  • 特点
    • 支持 OpenAPI 3.0 标准。
    • 自动扫描,无需复杂配置。
    • 支持 Swagger UI 和 ReDoc。
  • 配置示例
    <!-- pom.xml -->
    <dependency><groupId>org.springdoc</groupId><artifactId>springdoc-openapi-ui</artifactId><version>1.6.12</version>
    </dependency>
    
  # application.propertiesspringdoc.api-docs.path=/api-docsspringdoc.swagger-ui.path=/swagger-ui
  • 访问地址http://localhost:8080/swagger-ui

2. Swagger UI (官方版)
  • 特点
    • 官方维护的 UI 组件。
    • 需手动配置 OpenAPI 定义文件。
    • 灵活适配多种后端技术。
  • 配置示例
    <!-- pom.xml -->
    <dependency><groupId>io.swagger.core.v3</groupId><artifactId>swagger-ui</artifactId><version>2.2.10</version>
    </dependency>
    
  @SpringBootApplicationpublic class Application {public static void main(String[] args) {SpringApplication app = new SpringApplication(Application.class);// 配置 Swagger UI 路径app.setDefaultProperties(Collections.singletonMap("spring.resources.static-locations", "classpath:/META-INF/resources/"));app.run(args);}}

3. RAML
  • 特点
    • 基于 RAML(RESTful API Modeling Language)描述接口。
    • 支持自动生成文档和客户端代码。
    • 适合需要详细接口规范的团队。
  • 工具:使用 RAML ResolverRAML Console 生成文档。

4. Apigee
  • 特点
    • 企业级 API 管理平台。
    • 提供完整的 API 生命周期管理(发布、监控、安全等)。
    • 支持多语言文档生成。
  • 适用场景:大型分布式系统、微服务架构。

三、功能对比表格

框架支持协议配置复杂度适用场景核心功能访问方式
SpringfoxSwagger 2.0中等Spring Boot 项目、简单配置自动扫描、注解配置、支持分组http://localhost:8080/swagger-ui.html
Springdoc OpenAPIOpenAPI 3.0现代 Spring Boot 项目、自动扫描支持 OpenAPI 3、ReDoc、Swagger UIhttp://localhost:8080/swagger-ui
Swagger UIOpenAPI 2/3需手动配置 OpenAPI 定义文件灵活适配多种后端技术自定义路径
RAMLRAML需详细接口规范的团队自动生成文档和客户端代码需第三方工具支持
Apigee多种协议企业级 API 管理、复杂系统生命周期管理、监控、安全策略云端或私有部署

四、选择建议

  • 简单快速集成:选择 Springdoc OpenAPI(支持 OpenAPI 3,配置简单)。
  • Spring Boot 项目:优先 SpringfoxSpringdoc
  • 手动控制文档:使用 Swagger UIRAML
  • 企业级需求:选择 Apigee

通过以上配置和对比,您可以根据项目需求选择最合适的框架。

http://www.dtcms.com/wzjs/156046.html

相关文章:

  • 做app网站的公司名称广告联盟骗局
  • 合肥建设工程交易网站网址提交百度
  • 网站做优化有必要吗360广告推广平台
  • 宿州网站建设零聚思放心纯手工seo公司
  • 做网站项目前期工作包括哪些2022最近的新闻大事10条
  • 网页设计与制作教程第四版课后答案网站优化关键词排名公司
  • wordpress pingseo技术服务外包
  • 棋牌游戏wordpressseo营销名词解释
  • h5网站建设是什么意思如何优化seo
  • 网站开发导航qq营销
  • 建设网站多少费用网络推广的方式有哪些
  • 微信、网站提成方案点做东营网站推广公司
  • 狼雨seo网站排名查询市场监督管理局
  • 区县12380网站建设情况百度云网页版登录入口
  • 网站建设大学口碑推广
  • 认证网站所有权要添加代码做引流的公司是正规的吗
  • 类似于拼多多的网站怎么做seo网站优化价格
  • 有没有做博物馆的3d网站品牌推广方式有哪些
  • 博客网站建设基本流程推广的渠道和方法有哪些
  • 锦州做网站百度seo在哪里
  • wordpress metaslider关键词优化上海
  • 怎么做论坛社区网站百度提交入口
  • 电子商务公司建设网站方案线上推广平台
  • 有哪些做笔译的网站公司推广
  • 长沙传媒公司泽成seo网站排名
  • 网页建设类有哪些软件关键词排名优化易下拉霸屏
  • 临沂购买模板建站关键词录入榜
  • 做团购网站哪家好些软文500字范文
  • 成都商城网站开发图片识别 在线识图
  • 网站qq 微信分享怎么做焊工培训内容有哪些