swagger2 缺少json示例数据或者不展示

 加@Data

package com.itheima.education.content.model.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * User: ldj
 * Date: 2023/4/18
 * Time: 20:09
 * Description: 课程查询条件模型类
 */
@Data
@ApiModel("课程查询入参模型")
public class QueryCourseParamsDto {

    @ApiModelProperty("课程名称")
    private String courseName;

    @ApiModelProperty("审核状态")
    private String auditStatus;

    @ApiModelProperty("发布状态")
    private String publishStatus;
}

1.spring- boot -swagger2-starter

        <!-- Spring Boot 集成 swagger -->
        <dependency>
            <groupId>com.spring4all</groupId>
            <artifactId>swagger-spring-boot-starter</artifactId>
            <version>1.9.0.RELEASE</version>
        </dependency>

2. bootstrap.yml

#swagger2 文档配置
swagger:
  title: "内容管理系统"
  description: "内容系统管理系统对课程相关信息进行业务管理数据"
  base-package: com.itheima.education.content   #(扫描模块Controller)
  enabled: true
  version: 1.0.0

 3.启动类加@EnableSwagger2Doc​​famhe

package com.itheima.education.content;

import com.spring4all.swagger.EnableSwagger2Doc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;

@EnableCaching
@EnableSwagger2Doc //开启swagger
@SpringBootApplication
public class ContentApiApplication {

    public static void main(String[] args) {
        SpringApplication.run(ContentApiApplication.class, args);
    }

}

4. 访问首页  http://ip:port/swagger-ui.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值