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

合肥网站优化seo课堂

合肥网站优化,seo课堂,电商法规定企业网站必须做3年,直销建设网站前言 swagger是啥&#xff0c;是干什么的&#xff0c;有什么用&#xff0c;我想在这里我就不用介绍了&#xff0c;下面直接代码演示。 添加依赖 <?xml version"1.0" encoding"UTF-8"?> <project xmlns"http://maven.apache.org/POM/4.0.0…

前言

swagger是啥,是干什么的,有什么用,我想在这里我就不用介绍了,下面直接代码演示。

添加依赖

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.inchlifc</groupId><artifactId>SwaggerDemo</artifactId><version>0.0.1-SNAPSHOT</version><packaging>jar</packaging><name>SwaggerDemo</name><description>Demo project for Spring Boot</description><properties><java.version>8</java.version></properties><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.5.9</version></parent><dependencies><dependency><groupId>io.springfox</groupId><artifactId>springfox-spring-web</artifactId><version>3.0.0</version></dependency><dependency><groupId>io.springfox</groupId><artifactId>springfox-boot-starter</artifactId><version>3.0.0</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><version>3.1.3</version></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><excludes><exclude><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></exclude></excludes></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.1</version></plugin></plugins></build></project>

 添加配置

package com.inchlifc.swaggerdemo.config;import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;/*** Swagger3的接口配置* * @author chery*/
@Configuration
public class SwaggerConfig{// 控制是否允许swaggerprivate boolean enableSwagger = true;@Beanpublic Docket api() {return new Docket(DocumentationType.OAS_30) //展示的swagger文档格.enable(enableSwagger) //是否启动swagger配置.select().apis(RequestHandlerSelectors.any()).paths(PathSelectors.any()).build();}}

配置文件

spring:mvc:pathmatch:matching-strategy: ant_path_matcher

测试Controller

package com.inchlifc.swaggerdemo.controller;import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;@RestController
@RequestMapping("/swagger")
@Api(value = "测试",tags = {"测试Swagger"})
public class TestController {@ApiOperation(value = "测试接口")@RequestMapping(value = "/hello",method = RequestMethod.GET)public String hello(){return "hello";}
}

启动演示

http://www.rdtb.cn/news/2094.html

相关文章:

  • 自己搭建个人网站百度 官网
  • 政府网站建设新媒体指标百分百营销软件官网
  • 小程序设计开发西青seo
  • 襄阳网站建设培训网络推广
  • 静态网站建设的主要技术重庆seo网页优化
  • 贵阳网络网站建设吉林百度查关键词排名
  • 设计网站怎么做网络推广是啥
  • 网站怎么做移动图片不显示不出来英文关键词seo
  • 电子商务网站规划建设与管理超级软文
  • 设计企业网站步骤app注册接单平台
  • 营销型网站建设的特色电销系统软件排名
  • 专业网站建设推荐西安疫情最新数据消息中高风险地区
  • 民族服装的网站建设东莞网站建设推广平台
  • 国内精美网站欣赏重庆森林电影
  • 学生制作网页教程西安seo网站管理
  • 网站可信认证在哪里做全网营销方案
  • 确定网站推广目标黄页引流推广网站软件免费
  • 政府网站域名注册项目营销推广策划
  • 广州外贸网站建设 open六年级上册数学优化设计答案
  • 怎么建设自己淘宝网站首页郑州网络推广报价
  • 17网站一起做武汉推广系统
  • 简易logo图片大全太原关键词排名优化
  • 徐州做网站那家好百度站长中心
  • 如何通审查元素做网站实时新闻最新消息
  • 青岛哪家做网站的公司广告投放代理商加盟
  • wordpress首页文章轮播网站seo服务
  • 怎样做私人网站百度统计平台
  • 营销和运营的区别是什么seo诊断站长
  • 给小孩子做网站网络推广公司经营范围
  • 网站建设免费建站免费源代码百度贴吧官网网页