//不需要时,或者生产环境可以在此处关闭
.enable(true);
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("JCccc springboot整合Swagger2项目 ")
.description(“描述:测试使用Swagger2!”)
//服务条款网址
.termsOfServiceUrl(“https://blog.csdn.net/qq_35387940”)
.contact(“JCccc”)
.version(“1.0”)
.build();
}
}
然后是写一个Controller ,整合Swagger2框架注解 Swagger2TestController.java:
import com.alibaba.fastjson.JSONObject;
import com.soelegant.elegantdemo.pojo.UserInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
/**
-
@Author:JCccc
-
@Description:
-
@Date: created in 20:54 2019/5/25
*/
@Api(value = “测试各种方法”, tags = {“测试使用Controller”})
@RestController
public class Swagger2TestController {
@ApiOperation(value = “测试Swagger2接口”, notes = “传入编号!”)
@ApiImplicitParam(name = “id”, value = “id”, required = true)
@RequestMapping(value = “/swaTest2/{id}”, method = RequestMethod.GET)
public String TestSwa2(@PathVariable(“id”) Integer id) {