使用swagger构建restful api
This commit is contained in:
@@ -36,8 +36,6 @@ public class Swagger2 {
|
||||
.description("更多Spring Boot相关文章请关注:http://blog.didispace.com/")
|
||||
.termsOfServiceUrl("http://blog.didispace.com/")
|
||||
.contact("程序猿DD")
|
||||
.license("")
|
||||
.licenseUrl("")
|
||||
.version("1.0")
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -23,14 +23,14 @@ public class UserController {
|
||||
static Map<Long, User> users = Collections.synchronizedMap(new HashMap<Long, User>());
|
||||
|
||||
@ApiOperation(value="获取用户列表", notes="")
|
||||
@RequestMapping(value={"/", ""}, method=RequestMethod.GET)
|
||||
@RequestMapping(value={""}, method=RequestMethod.GET)
|
||||
public List<User> getUserList() {
|
||||
List<User> r = new ArrayList<User>(users.values());
|
||||
return r;
|
||||
}
|
||||
|
||||
@ApiOperation(value="创建用户", notes="根据User对象创建用户")
|
||||
@RequestMapping(value="/", method=RequestMethod.POST)
|
||||
@RequestMapping(value="", method=RequestMethod.POST)
|
||||
public String postUser(@RequestBody User user) {
|
||||
users.put(user.getId(), user);
|
||||
return "success";
|
||||
|
||||
Reference in New Issue
Block a user