首页>代码>搭建Spring Boot中使用Swagger2构建RESTful APIs>/sm/src/main/java/com/mch/boot/sm/controller/IndexController.java
package com.mch.boot.sm.controller;
import com.mch.boot.sm.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
/**
* @Desc IndexController
* @Desc 测试 swgger 接口说明
* @author mch
*/
@Api(tags = "首页文档说明")
@RestController
@RequestMapping(value="/index") // 通过这里配置使下面的映射都在/users下,可去除
public class IndexController {
static Map<Long, User> users = Collections.synchronizedMap(new HashMap<Long, User>());
@ApiOperation(value="首页列表", notes="首页列表")
@RequestMapping(value={"/list"}, method= RequestMethod.GET)
public List<User> getUserList() {
List<User> r = new ArrayList<User>(users.values());
return r;
}
}
最近下载更多
大神程序员 LV23
7月10日
微信网友_6368711690080256 LV3
2023年2月28日
0592lyj LV9
2023年2月16日
906933050 LV1
2022年10月9日
zhulei886 LV14
2021年5月19日
xhmpmail LV17
2021年2月22日
lincolnpan LV9
2021年2月2日
diadream LV3
2021年1月18日
最代码官方 LV168
2021年1月10日

最近浏览