昂首阔步:无法使用Jaxrs

时间:2019-04-28 05:57:32

标签: java jax-rs swagger swagger-ui

根据Swagger 1.x documentation,我在模型类上使用了@ApiModel@ApiModelProperty

// @XmlRootElement(name="TempUser")
@ApiModel(value="Tempuser", description="Sample model for the documentation")
public class Tempuser {

        @ApiModelProperty( value = "Person's first name", required = true ) 
        private String name;

        public Tempuser(String name) {
            this.name = name;
        }

        // @XmlElement(name = "name")  
        // @ApiModelProperty(example = "peter", required = true)
        public String getName() {
            return name;
        }

        public void setType(String name) {
            this.name = name;
        }

        public static Tempuser valueOf(String name) {
            return new Tempuser(name);
        }

}

我已经尝试通过注释和取消注释@XmlRootElement,但是Swagger UI不在模型列表中显示此类。该软件包已添加到扫描列表中。

enter image description here

0 个答案:

没有答案