首页>代码>搭建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日
最近浏览更多
大神程序员  LV23 7月10日
内心向阳  LV4 2023年11月7日
微信网友_6368711690080256  LV3 2023年2月28日
jk-mack  LV5 2023年2月19日
0592lyj  LV9 2023年2月16日
906933050  LV1 2022年10月9日
wsupsup  LV16 2022年9月28日
哎呀马吖  LV6 2022年8月24日
2468867327  LV10 2022年5月17日
nbtest  LV1 2022年2月28日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友