Talking about springfox-swagger principles and difficulties encountered during use,
About swagger
Swagger is really a good thing. It can automatically generate relevant api documentation based on Business Code, especially for restful projects. developers can hardly need to maintain rest APIs, this framework can automat
First, prefaceLet's take a look at the relationship between Springfox and swagger first . Swagger api api declaration "( OPENAPI specification oas api Oas api specification, which describes a complete set of api interface, including an interface that is get or post request Ah, what are the parameters which header Ah, will be included in t
Original: documenting a Spring Data REST API with Springfox and Swagger
With spring date REST, you can quickly create rest APIs for spring date repositories, and provide crud and more functionality. However, with the rigorous API development success, you also want to have the latest API documentation automatically generated.
Code Example
This article comes with work sample code GitHub
First, prefaceLet's take a look at the relationship between Springfox and swagger first. Swaggerapi development framework, this framework with "open api Declaration "(OPENAPI specification ,oas) based on the entire The development cycle of span style= "Font-family:calibri" >api Oasapi Specification, which is used to describe a complete set of api interface, including an interface that is getPOST request
Depend on://mvnrepository.com/artifact/io.springfox/springfox-swagger2-// Mvnrepository.com/artifact/io.springfox/springfox-swagger-ui-Use: Add annotations to the interface you want to generate @EnableSwagger2, here is the whole project, not recommended to play, it is recommended to add to the controller@SpringBootApplication@EnableSwagger2 Public class Applic
This example is based on the previous combat series, and if the company framework uses JDK7 above and its spring+mybatis+springmvc/spring+mybatis PLUS+SPRINGMVC can refer directly to the instance.However, it is advisable to use Jdk8+spring+mybatis PLUS+SPRINGMVC, as this example is based on this.The reason for integrating Springfox+swagger2 is because the feature is integrated swagger because of the previou
://localhost:8080/swagger-ui.html. This allows you to see the interfaces you have defined. But if you want to write the test class to test their own written interface, the swagger configured in this way, when the unit test will be reported error. As follows:
org.springframework.transaction.annotation.proxytransactionmanagementconfiguration$ $EnhancerBySpringCGLIB $$ CFBCB6CB] is not eligible for getting p
First, IntroductionSpringfox, formerly known as SWAGGER-SPRINGMVC, is an open source API Doc framework that can be used to document the way our controller is presented.Second, Access 1, pom-dependent 1) necessary
2) If the project relies on a spring version less than 3.2.0.RELEASE, you need to upgrade spring-web dependencies, and guava version dependencies
2. S
1.Adding the Maven DependencyAs mentioned above, we'll use the Springfox implementation of the Swagger specification. To add it to my Maven project, we need a dependency in the Pom.xml file.
Io.springfox
Springfox-swagger2
2.7.0
2.Integrating Swagger 2 into the Project
2.1.Java Configuration The conf
1, the establishment of a spring MVC project;2. Add Pom dependency:1 Properties>2 springfoxversion>2.6.1springfoxversion>3 Properties>4 Dependencies>5 Dependency>6 groupId>Io.springfoxgroupId>7 Artifactid>Springfox-swagger2Artifactid>8 version>${springfoxversion}version>9 Scope>CompileScope>Ten Dependency> One Dependencies> A - Dependency> - groupId>Com.fasterxml.jackson.coregroupId> the Artifactid>
, when you search the Internet, you may find another tool: Springfox. There are also a lot of articles online about Springfox and spring integration. What is the relationship between Springfox and swagger? Quote Springfox's Official quotations:
Springfox has evolved from a p
2017-05-16 11:58:05.276 INFO 11268---[main] s.c.a.annotationconfigapplicationcontext:refreshing Org.spring[email Pro Tected]58bf3596:startup Date [Tue May 11:58:05 CST 2017]; Root of context Hierarchy2017-05-16 11:58:06.452 INFO 11268---[main] trationdelegate$beanpostprocessorchecker:bean ' Org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration ' of type [ org.springframework.transaction.annotation.proxytransactionmanagementconfiguration$ $EnhancerBySpringCGLIB $$ CFB
Webapi after writing, online Help documentation and tools to debug online are professional performance, and swagger is undoubtedly the best tool to do docs, automatically generate the interface description of each controller, automatically parse the parameters into JSON, and be able to debug online.So what are the steps you need to apply to ASP. Swagger and how many pits to fill?Install
First, IntroductionThe goal of Swagger is to define a language-independent standard interface for the rest API that allows users to discover and understand the capabilities of a computer service without having to access the source code. When properly defined through swagger, the user can understand and interact with the remote service with the least amount of implementation logic. Interfaces that are simila
The blog on the website about Chinese is a lot of things, and many of them have wasted a lot of my time.And then just get ready to bite. Read the English Documentation:https://packagist.org/packages/zircote/swagger-phpTo build the site, using the Yii2 2.0.12Installing with composerComposer require zircote/swagger-phpand then download Swagger-ui. This is primarily
Installation of Swagger-editor
The YAML syntax applied by the
swagger-editor, with defined variables and data structures, does not understand that it is possible to refer to its example
installation steps:
download swagger-editor git address
shipping Line NPM Run build generates a running package
Window co
Because the company uses the spring version is too high, in the integration of swagger, there will be some problems, and many of the online instances are mostly version of the lower, in order to be friends less than the pit, my side will integrate the process to record:
Introduce spring, swagger related jar packages (Springfox-swagger2,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.