亿众分发系统
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

SwaggerConfig.java 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * Copyright (c) 2016-2019 人人开源 All rights reserved.
  3. *
  4. * https://www.renren.io
  5. *
  6. * 版权所有,侵权必究!
  7. */
  8. package io.renren.common.config;
  9. import io.swagger.annotations.ApiOperation;
  10. import org.springframework.context.annotation.Bean;
  11. import org.springframework.context.annotation.Configuration;
  12. import springfox.documentation.builders.ApiInfoBuilder;
  13. import springfox.documentation.builders.PathSelectors;
  14. import springfox.documentation.builders.RequestHandlerSelectors;
  15. import springfox.documentation.service.ApiInfo;
  16. import springfox.documentation.spi.DocumentationType;
  17. import springfox.documentation.spring.web.plugins.Docket;
  18. import springfox.documentation.swagger2.annotations.EnableSwagger2;
  19. /**
  20. * Swagger配置
  21. *
  22. * @author Mark sunlightcs@gmail.com
  23. */
  24. @Configuration
  25. @EnableSwagger2
  26. public class SwaggerConfig{
  27. @Bean
  28. public Docket createRestApi() {
  29. return new Docket(DocumentationType.SWAGGER_2)
  30. .apiInfo(apiInfo())
  31. .select()
  32. //加了ApiOperation注解的类,生成接口文档
  33. .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
  34. //包下的类,生成接口文档
  35. //.apis(RequestHandlerSelectors.basePackage("io.renren.modules.job.controller"))
  36. .paths(PathSelectors.any())
  37. .build();
  38. }
  39. private ApiInfo apiInfo() {
  40. return new ApiInfoBuilder()
  41. .title("人人开源")
  42. .description("renren-admin文档")
  43. .termsOfServiceUrl("https://www.renren.io")
  44. .version("4.0.0")
  45. .build();
  46. }
  47. }