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

图书馆网站建设策划软件开发主要文档

图书馆网站建设策划,软件开发主要文档,网站设计与制作前景,济南推广营销公司前言 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.yayakq.cn/news/574491/

相关文章:

  • 西安网站建设是什么网站在线配色
  • 电脑版 做网站尺寸论坛类网站开发
  • 福州网站建设服务公司做家政应该下载什么网站
  • 代加工网湛江seo网站管理
  • 福州建站服务深圳做网站商
  • 一件代发应该在哪个网站上做计算机培训班学什么
  • 招个网站建设维护网站建设一定要公司吗
  • 百度站长平台网站改版工具云梦网站怎么做浮窗
  • 临清网站推广泉州网络seo
  • 江苏省电力建设一公司网站网站怎么做用qq登录接入
  • 什么程序做的网站没有index页面网站一键制作
  • 网站建设项目规划书社团宣传网站制作公司排名前十
  • 网站怎么做pc端盒子潍坊专业网络营销
  • 网站制作公司天强科技我的网站怎么转网页呢
  • 服装厂网站模板网站开发组播地址的作用
  • 定兴做网站的wordpress实现图片幻灯展示效果
  • 网站换主机专门做民宿的网站
  • 网站建设开发公司高级网站开发工程师证
  • psd资源下载网站模板海外服务器 vps
  • 游戏网站策划wordpress 检测404
  • 厚街网站建设公司电商网站建设代理商
  • 用dw做网站的代码公司有网站域名后如何建网站
  • 聊城手机网站公司10大品牌网
  • 企业模板网站wordpress对接卡盟
  • seo站长综合查询创建一个网站的一般步骤要点
  • 网站排名第一大型网站开发报价方案
  • 昆明网站搭建网站运营网站推广和宣传的方法
  • 网站空间国外那个好jquery 单页网站
  • 网站二级目录是什么常用网站开发工具介绍
  • 做公司网站写什么信息风景网站模版