我是java的新手。正在尝试开发一个应用程序来调度cron作业中的http api调用。只有方法名称将是输入。所有apis都配置了swagger注释。我是否可以使用这些注释来确定api是post、get还是delete等。
public class ABC {
@ApiOperation(
httpMethod = "GET",
value = "value",
notes = "notes",
response = ABC.class)
ABC getValue()
{
}
} 只有getValue是我的应用程序的输入。是否可以获取@ApiOperation值来确定http方法类型。
发布于 2018-02-22 18:59:10
您可以,但它在RequestMapping注释中(在该注释中,您指定哪个URL应链接到该方法):
例如,当有人在GET中导航到myBaseURl/persons时,将调用此方法。它将返回JSON。
@ApiOperation( value = "List of persons",
notes = "List all my base's persons. ",
response = Person.class,
responseContainer = "List",
tags = { "Persons", })
@RequestMapping(value = "/persons",
produces = { "application/json" },
method = RequestMethod.GET)
public PagedResources<PersonResource> persons(...) {}https://stackoverflow.com/questions/48925519
复制相似问题