In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces how to integrate Swagger in Spring MVC. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.
Swagger integration of SpringMVC component configuration (custom style adjustment) (springmvc-swagger)-integration of swagger static resources and SpringMVC projects-support for custom style development-development environment based on swagger2.2.10 version-tomcat 7.0.78-jdk 1.7 configuration-spring 4.3.13.RELEASESwaggerConfig configuration class package cn.com.showclear.config;import com.mangofactory.swagger.configuration.SpringSwaggerConfig;import com.mangofactory.swagger.models.dto.ApiInfo Import com.mangofactory.swagger.plugin.EnableSwagger;import com.mangofactory.swagger.plugin.SwaggerSpringMvcPlugin;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.ComponentScan;import org.springframework.web.servlet.config.annotation.EnableWebMvc / * Swagger initialization configuration file * @ author YF-XIACHAOYANG * @ date 2017-12-26 10:13 * / @ EnableWebMvc@EnableSwagger@ComponentScan (basePackages = "cn.com.showclear.activiti.controller.data") public class SwaggerConfig {private SpringSwaggerConfig springSwaggerConfig; / * Required to autowire SpringSwaggerConfig * / @ Autowired public void setSpringSwaggerConfig (SpringSwaggerConfig springSwaggerConfig) {this.springSwaggerConfig = springSwaggerConfig } / * * Every SwaggerSpringMvcPlugin bean is picked up by the swagger-mvc * framework-allowing for multiple swagger groups i.e. Same code base * multiple swagger resource listings. * / @ Bean public SwaggerSpringMvcPlugin customImplementation () {return new SwaggerSpringMvcPlugin (this.springSwaggerConfig) .apiInfo (apiInfo ()) .origindePatterns (". *?") } private ApiInfo apiInfo () {ApiInfo apiInfo = new ApiInfo ("Scooper Activiti REST-API", "Workflow background Interface Test", "My Apps API terms of service", "xiazhaoyang@live.com", "web app", "My Apps API License URL"); return apiInfo }} spring-mvc.xmlspring-servlet.xml web.xml springmvc org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath:/config/spring/spring-servlet.xml 1 springmvc / index.html/* add style * / .hide {display:none;} / * adjust path * / url = "/ scooper-activiti/api-docs" / * hide headers * / maven depends on com.mangofactory swagger-springmvc 0.9.5 com.fasterxml.jackson.core jackson-annotations 2.4.4 com.fasterxml.jackson.core jackson-databind 2.4.4 com.fasterxml.jackson.core jackson-core 2.8.9
Project directory structure
REFRENCE1, swagger integrate https://www.cnblogs.com/jtlgb/p/6734177.htmlhttps://www.2cto.com/kf/201604/499072.htmlhttp://blog.csdn.net/hayre/article/details/51027201http://www.mamicode.com/info-detail-525592.html2, Can't read swagger JSON from http... http://blog.csdn.net/shecanwin/article/details/55667102http://blog.csdn.net/xyw591238/article/details/519391113, No qualifying bean of type 'com.mangofactory.swagger.configuration.SpringSwaggerConfig' available:... https://www.cnblogs.com/driftsky/p/4952918.html4, swagger file upload http://blog.csdn.net/qq_23167527/article/details/78559096swagger static resource file download 1, version download list https://github.com/Yiyuery/swagger-ui2, 2.2.10 download link https://github.com/swagger-api/swagger-ui/tree/v2.2.10
Note: select version 2.0 + for swagger [2.2.10]
Effect.
On how to integrate Swagger in Spring MVC to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.