标签:turn 配置 rest esc spring sep ring user ppi
<dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.6.1</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.6.1</version> </dependency>
@Configuration @EnableSwagger2 public class Swagger { @Bean public Docket docket() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.example.demo.controller")) .paths(PathSelectors.any()) .build(); } public ApiInfo apiInfo() { return new ApiInfoBuilder() .title("PM Supply") .description("版本") .termsOfServiceUrl("") .version("1.0") .build(); } }
@Api(value = "用户管理类") @RestController @RequestMapping(value = "user") public class UserController { @RequestMapping(value = "/user", method = RequestMethod.POST) @ApiOperation(value = "增加一个用户") public String addUser(@RequestBody User user) { return user.getName(); } }
@Api(value = "用户管理类")
@RestController
@RequestMapping(value = "user")
public class UserController {
@RequestMapping(value = "/user", method = RequestMethod.POST)
@ApiOperation(value = "增加一个用户")
public String addUser(@RequestBody User user) {
return user.getName();
}
}
标签:turn 配置 rest esc spring sep ring user ppi
原文地址:https://www.cnblogs.com/oxygenG/p/13394638.html