swagger 提交

parent 283ba663
...@@ -87,15 +87,20 @@ ...@@ -87,15 +87,20 @@
</exclusions> </exclusions>
</dependency> </dependency>
<!-- swagger --> <!-- swagger -->
<dependency> <!--<dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId> <artifactId>springfox-swagger-ui</artifactId>
<version>2.4.0</version> <version>2.4.0</version>
</dependency> </dependency>-->
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId> <artifactId>springfox-swagger2</artifactId>
<version>2.4.0</version> <version>2.9.2</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.9.6</version>
</dependency> </dependency>
<!--引入JWT依赖,由于是基于Java,所以需要的是java-jwt --> <!--引入JWT依赖,由于是基于Java,所以需要的是java-jwt -->
<dependency> <dependency>
......
...@@ -7,7 +7,9 @@ import org.springframework.boot.actuate.health.Health; ...@@ -7,7 +7,9 @@ import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement
@SpringBootApplication @SpringBootApplication
@EnableCaching @EnableCaching
public class DmpApplication implements HealthIndicator { public class DmpApplication implements HealthIndicator {
......
package com.jz.dmp.config;
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* @ClassName: SwaggerConfiguration
* @Author Bellamy
* @Date 2020/11/26
*/
@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
public class SwaggerConfiguration {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.jz.dmp.modules.controller"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("数据中台 APIs")
.description("swagger-bootstrap-ui")
.termsOfServiceUrl("http://localhost:5050/")
.contact("Bellamy")
.version("1.0")
.build();
}
}
package com.jz.dmp.modules.controller; package com.jz.dmp.modules.controller;
import com.jz.common.constant.JsonResult;
import com.jz.dmp.modules.service.AtomBaseCacheService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import com.jz.common.constant.JsonResult;
import com.jz.dmp.modules.service.AtomBaseCacheService;
/** /**
* 暂时注释 * 暂时注释
* @author 86186 * @author 86186
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment