美文网首页
springboot-swagger

springboot-swagger

作者: zxy_3197 | 来源:发表于2019-02-21 15:09 被阅读0次

    1.pom.xml配置
    <dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>2.7.0</version>
    </dependency>
    <dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>2.7.0</version>
    </dependency>
    2.application.yml配置
    swagger:
    basePackage: com.example.demo.controller
    contact: com.example.demo
    title: API list
    version: 1.0
    3.主程序需要添加@EnableSwagger2注解
    4.controller示例
    @ApiOperation(value = "addAccount", httpMethod = "GET", response = Date.class, notes = "添加用户账号")
    @RequestMapping(value = "getuser",method = RequestMethod.GET)
    public Integer getUser() {
    String keys = redisService.get("WECHAT:CUSTOMIZE:MENU:VERSION",String.class);
    System.out.println(keys);
    Integer userById = userService.getUserById();
    return userById;
    }

    相关文章

      网友评论

          本文标题:springboot-swagger

          本文链接:https://www.haomeiwen.com/subject/zobryqtx.html