swagger如何屏蔽某些接口,不对外公开——使用ApiIgnore
@ApiIgnore
@RestController
@RequestMapping(value = "/i18nTest")
public class I18nTestController {
// @Resource
// private LocaleMessageSourceService localeMessageSourceService;
//
@Autowired
private MessageSource messageSource;
@RequestMapping(value = "/test")
public void test(HttpServletRequest request) throws Exception {
//常规做法
Locale locale = LocaleContextHolder.getLocale();
String result = messageSource.getMessage("world", null, locale);
//做了一层封装
// String result = localeMessageSourceService.getMessage("world");
//又加了一层封装
// String result = LocaleMessageUtil.getMessage("world");
request.setAttribute(SysConstant.Result, result);
}
}说明
Controller上加 @ApiIgnore,没加前该接口API会出现在Swagger中。加上后则不会出现在Swagger中。

相关推荐
SAMXIE 2020-07-26
哈嘿Blog 2020-09-08
SAMXIE 2020-11-04
XuDanT 2020-09-16
permanent00 2020-09-15
Qizonghui 2020-08-02
莫问前程 2020-08-02
XuDanT 2020-07-24
莫问前程 2020-07-18
Qizonghui 2020-07-18
coolhty 2020-07-05
Qizonghui 2020-06-28
Qizonghui 2020-06-25
莫问前程 2020-06-22
SAMXIE 2020-06-14
莫问前程 2020-06-14
XuDanT 2020-06-07
qingjiuquan 2020-06-07
TimeMagician 2020-06-03