关闭spirng boot集成springdoc-openapi的接口文档

server/2024/9/24 4:15:08/

springdoc-openapi依赖包

<dependency><groupId>org.springdoc</groupId><artifactId>springdoc-openapi-starter-webmvc-ui</artifactId><version>2.1.0</version></dependency><dependency><groupId>org.springdoc</groupId><artifactId>springdoc-openapi-starter-webmvc-api</artifactId><version>2.1.0</version></dependency>

关闭方式

# 配置文件中添加如下配置
springdoc:swagger-ui:enabled: false

关键部分代码分析

java">/***  **  *  **  *  *  **  *  *  *  * Copyright 2019-2022 the original author or authors.*  *  *  *  **  *  *  *  * Licensed under the Apache License, Version 2.0 (the "License");*  *  *  *  * you may not use this file except in compliance with the License.*  *  *  *  * You may obtain a copy of the License at*  *  *  *  **  *  *  *  *      https://www.apache.org/licenses/LICENSE-2.0*  *  *  *  **  *  *  *  * Unless required by applicable law or agreed to in writing, software*  *  *  *  * distributed under the License is distributed on an "AS IS" BASIS,*  *  *  *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.*  *  *  *  * See the License for the specific language governing permissions and*  *  *  *  * limitations under the License.*  *  *  **  *  **  ***/package org.springdoc.core.properties;import java.util.Set;
import java.util.stream.Collectors;import org.apache.commons.lang3.StringUtils;
import org.springdoc.core.configuration.SpringDocConfiguration;
import org.springdoc.core.utils.Constants;import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;import static org.springdoc.core.utils.Constants.SPRINGDOC_SWAGGER_UI_ENABLED;/*** The type Swagger ui config properties.* @author bnasslahsen*/
@Lazy(false)
@Configuration(proxyBeanMethods = false)
@ConfigurationProperties(prefix = "springdoc.swagger-ui")
@ConditionalOnProperty(name = SPRINGDOC_SWAGGER_UI_ENABLED, matchIfMissing = true)
@ConditionalOnBean(SpringDocConfiguration.class)
public class SwaggerUiConfigProperties extends AbstractSwaggerUiConfigProperties {/*** The Disable swagger default url.*/private boolean disableSwaggerDefaultUrl;/*** The Swagger ui version.*/private String version;/*** The Csrf configuration.*/private Csrf csrf = new Csrf();/*** The Syntax Highlight configuration.*/private SyntaxHighlight syntaxHighlight = new SyntaxHighlight();/*** Whether to generate and serve an OpenAPI document.*/private boolean enabled = true;/*** The Use root path.*/private boolean useRootPath;/*** Gets swagger ui version.** @return the swagger ui version*/public String getVersion() {return version;}/*** Sets swagger ui version.** @param version the swagger ui version*/public void setVersion(String version) {this.version = version;}/*** Is use root path boolean.** @return the boolean*/public boolean isUseRootPath() {return useRootPath;}/*** Sets use root path.** @param useRootPath the use root path*/public void setUseRootPath(boolean useRootPath) {this.useRootPath = useRootPath;}/*** Is enabled boolean.** @return the boolean*/public boolean isEnabled() {return enabled;}/*** Sets enabled.** @param enabled the enabled*/public void setEnabled(boolean enabled) {this.enabled = enabled;}/*** Is disable swagger default url boolean.** @return the boolean*/public boolean isDisableSwaggerDefaultUrl() {return disableSwaggerDefaultUrl;}/*** Sets disable swagger default url.** @param disableSwaggerDefaultUrl the disable swagger default url*/public void setDisableSwaggerDefaultUrl(boolean disableSwaggerDefaultUrl) {this.disableSwaggerDefaultUrl = disableSwaggerDefaultUrl;}/*** Gets csrf.** @return the csrf*/public Csrf getCsrf() {return csrf;}/*** Sets csrf.** @param csrf the csrf*/public void setCsrf(Csrf csrf) {this.csrf = csrf;}/*** Is csrf enabled boolean.** @return the boolean*/public boolean isCsrfEnabled() {return csrf.isEnabled();}/*** Gets syntaxHighlight.** @return the syntaxHighlight*/public SyntaxHighlight getSyntaxHighlight() {return syntaxHighlight;}/*** Sets syntaxHighlight.** @param syntaxHighlight the syntaxHighlight*/public void setSyntaxHighlight(SyntaxHighlight syntaxHighlight) {this.syntaxHighlight = syntaxHighlight;}/*** Clone urls set.** @return the set*/public Set<SwaggerUrl> cloneUrls() {return this.urls.stream().map(swaggerUrl -> new SwaggerUrl(swaggerUrl.getName(), swaggerUrl.getUrl(), swaggerUrl.getDisplayName())).collect(Collectors.toSet());}/*** The type Csrf.* @author bnasslashen*/public static class Csrf {/*** The Enabled.*/private boolean enabled;/*** Use Local storage.*/private boolean useLocalStorage;/*** Use Session storage.*/private boolean useSessionStorage;/*** The Cookie name.*/private String cookieName = Constants.CSRF_DEFAULT_COOKIE_NAME;/*** The Local storage key.*/private String localStorageKey = Constants.CSRF_DEFAULT_LOCAL_STORAGE_KEY;/*** The Session storage key.*/private String sessionStorageKey = Constants.CSRF_DEFAULT_LOCAL_STORAGE_KEY;/*** The Header name.*/private String headerName = Constants.CSRF_DEFAULT_HEADER_NAME;/*** Is enabled boolean.** @return the boolean*/public boolean isEnabled() {return enabled;}/*** Sets enabled.** @param enabled the enabled*/public void setEnabled(boolean enabled) {this.enabled = enabled;}/*** Use Local storage boolean.** @return the boolean*/public boolean isUseLocalStorage() {return useLocalStorage;}/*** Sets useLocalStorage.** @param useLocalStorage the use local storage*/public void setUseLocalStorage(boolean useLocalStorage) {this.useLocalStorage = useLocalStorage;}/*** Use Session storage boolean.** @return the boolean*/public boolean isUseSessionStorage() {return useSessionStorage;}/*** Sets useSessionStorage.** @param useSessionStorage the use local storage*/public void setUseSessionStorage(boolean useSessionStorage) {this.useSessionStorage = useSessionStorage;}/*** Gets cookie name.** @return the cookie name*/public String getCookieName() {return cookieName;}/*** Sets cookie name.** @param cookieName the cookie name*/public void setCookieName(String cookieName) {this.cookieName = cookieName;}/*** Gets local storage key.** @return the cookie name*/public String getLocalStorageKey() {return localStorageKey;}/*** Sets local storage key.** @param localStorageKey the local storage key*/public void setLocalStorageKey(String localStorageKey) {this.localStorageKey = localStorageKey;}/*** Gets session storage key.** @return the cookie name*/public String getSessionStorageKey() {return sessionStorageKey;}/*** Sets local storage key.** @param sessionStorageKey the local storage key*/public void setSessionStorageKey(String sessionStorageKey) {this.sessionStorageKey = sessionStorageKey;}/*** Gets header name.** @return the header name*/public String getHeaderName() {return headerName;}/*** Sets header name.** @param headerName the header name*/public void setHeaderName(String headerName) {this.headerName = headerName;}}/*** The type Syntax highlight.* @author bnasslashen*/public static class SyntaxHighlight {/*** The Activated.*/private Boolean activated;/*** The Theme.*/private String theme;/*** Gets activated.** @return the activated*/public Boolean getActivated() {return activated;}/*** Sets activated.** @param activated the activated*/public void setActivated(Boolean activated) {this.activated = activated;}/*** Gets theme.** @return the theme*/public String getTheme() {return theme;}/*** Sets theme.** @param theme the theme*/public void setTheme(String theme) {this.theme = theme;}/*** Is present boolean.** @return the boolean*/public boolean isPresent() {return activated != null || StringUtils.isNotEmpty(theme);}}}

http://www.ppmy.cn/server/105810.html

相关文章

Redis补充

Redis事务 Redis事务的概念 Redis 事务的本质是一组命令的集合。事务支持一次执行多个命令&#xff0c;一个事务中所有命令都会被序列化。在事务执行过程&#xff0c;会按照顺序串行化执行队列中的命令&#xff0c;其他客户端提交的命令请求不会插入到事务执行命令序列中。 …

90.WEB渗透测试-信息收集-Google语法(4)

免责声明&#xff1a;内容仅供学习参考&#xff0c;请合法利用知识&#xff0c;禁止进行违法犯罪活动&#xff01; 内容参考于&#xff1a; 易锦网校会员专享课 上一个内容&#xff1a;89.WEB渗透测试-信息收集-Google语法&#xff08;3&#xff09; • inurl • 搜索特殊 UR…

深入理解 Go 语言并发编程底层原理

多协程同步是每一个 Go 开发者都必须面对的问题。传统的多线程程序往往基于共享内存实现多线程同步, Go 语言在此之上还提供了管道-协程的 CSP 同步模型,这也是 Go 语言推荐的方案。 1. 什么是并发问题 1.1 并发问题引入 1.2 并发操作切片 1.3 并发操作字符串 1.4 多核 CP…

wegege

c语言中的小小白-CSDN博客c语言中的小小白关注算法,c,c语言,贪心算法,链表,mysql,动态规划,后端,线性回归,数据结构,排序算法领域.https://blog.csdn.net/bhbcdxb123?spm1001.2014.3001.5343 给大家分享一句我很喜欢我话&#xff1a; 知不足而奋进&#xff0c;望远山而前行&am…

【Remi Pi Ubuntu虚拟机使用】winrar解压已经配置好的压缩包文件并登录

对于Remi Pi虚拟机的使用可以自己创建一个全新的虚拟机然后 按照《软件开发指南》进行SDK安装&#xff0c;但是如果读者是新手第一次接触强烈建议直接安装配置好的网盘虚拟机。 具体的解压方法请参考上一篇【Remi Pi开发环境搭建】主要包括虚拟机的创建以及开发板镜像的烧录-C…

移远5G平台交叉编译C++、OpenSSL

初级代码游戏的专栏介绍与文章目录-CSDN博客 我的github&#xff1a;codetoys&#xff0c;所有代码都将会位于ctfc库中。已经放入库中我会指出在库中的位置。 这些代码大部分以Linux为目标但部分代码是纯C的&#xff0c;可以在任何平台上使用。 这是操作记录。 移远的某款5G平…

【git】如何更改git绑定账号

更换之前同事的git账号&#xff08;gitee仓库&#xff09; 1、公钥配置 公钥的作用&#xff1a;身份验证&#xff0c;免去每次提交或拉去的登录操作。步骤&#xff1a; 1.安装git --> 鼠标右键 --> Git Bash Here -->进入命令窗口 命令一&#xff1a;查看git配置 …

【STM32】SPI接口(非连续传输)

本篇博客重点在于标准库函数的理解与使用&#xff0c;搭建一个框架便于快速开发 目录 前言 SPI简介 IO口初始化 SPI配置 时钟使能 SPI初始化 SPI使能 数据接收与发送 硬件SPI代码 MySPI.h MySPI.c 前言 【通信协议】SPI总线-CSDN博客 本篇博客学习使用STM32的…