Article directory 1. What is Swagger? 2. Usage steps 1.Introduce swagger3 dependency 2. Add swagger.conf configuration class 3. Add application.yml configuration 4. Check whether the integration is successful 5.Commonly used annotations 6.swagger beautification Summarize 1. What is Swagger? Swagger is a standardized and complete framework for generating, describing, invoking, and visualizing RESTful-style web services. The […]
Tag: swagger
springboot3 project uses swagger3
Article directory springboot3 project uses swagger3 rely swaggerConfig configuration Entity class example Control layer example Universal return result encapsulation Annotation description address git common commands springboot3 project uses swagger3 Dependencies <!–swagger3–> <dependency> <groupId>com.github.xiaoymin</groupId> <artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId> <version>4.1.0</version> </dependency> <repositories> <!–Alibaba Cloud Image–> <repository> <id>alimaven</id> <name>aliyun maven</name> <url>https://maven.aliyun.com/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> swaggerConfig configuration […]
The springfox-swagger parameter is an infinite recursive solution for objects
1. Background In the interface parameter receiving entity class, add a field to receive nested json parameters. For convenience, the type of this field is another entity class. In the usual development process, this is not the case. problem, and it can save a lot of tedious operations of obtaining values. 2. An error occurs […]
One article to solve: Swagger API unauthorized access vulnerability problem
Swagger is an open source software framework for designing, building, documenting, and consuming RESTful style web services. It makes it easier for developers to view and test API interfaces by providing an interactive documentation page. However, in some cases, unauthorized access may result in a security breach. This article will describe how to resolve the […]
[swagger configuration input parameters ignore certain fields]
Article directory 1. Background 1 Introduction 2. Existing practice 1 3. Method 2 supported by springfox 2. Question Three, ideas Fourth, realize 1. Define the annotation SwaggerInputFieldIgnore 2. Implement WebMvcOpenApiTransformationFilter 3. Implement WApiListingBuilderPlugin Five, results One, background 1. Introduction Use springfox to generate the swagger.json file, and then import it into yapi for display; when […]
Spring Boot integrated Swagger interface classification and sorting of each element
In the previous article, we completed the use of JSR-303 verification and used Swagger2 to obtain relevant interface documents. In this section, based on the original, we completed the specific configuration method in Swagger about controlling the order of each element. Swagger interface grouping First of all, we need to organize the interfaces in Swagger […]
SpringBoot integrates Swagger3
Foreword This article will introduce the integration process of the API visualization framework Swagger in the SpringBoot framework and a series of tests for Swagger3. Development background If the project is developed using a method of separating front-end and back-end, the development of front-end and back-end code requires developers to divide labor and collaborate, as […]
swagger3.0 sets up grouping and configures multiple scanning paths and filtering URLs
package com.jeeplus.config; import com.fasterxml.classmate.TypeResolver; import com.jeeplus.sys.service.dto.LightUserDTO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.schema.AlternateTypeRule; import springfox.documentation.service.*; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spring.web.plugins.Docket; import java.util.*; /** * swagger configuration */ @Configuration public class SwaggerConfig implements WebMvcConfigurer { @Bean public Docket api() {//Default grouping TypeResolver […]
Spring Boot integrates Swagger interface documentation tool
When we develop interfaces, we will provide the interface documents to front-end developers for docking. We can write and manage through interface management tools such as Postman or Yapi. In actual development, interface management should indeed be managed through professional tools. So, if it is only used by a small team, can we write the […]
Spring Boot integrates swagger2
In the previous article, we integrated the RESTful API project around Spring Boot. However, in our actual development, one of our RESTful APIs may serve multiple different developers or development teams, including but not limited to PC, Android, IOS, even the current Hongmeng OS, web development and so on. In order to reduce the cost […]