当前位置:网站首页>Get all interface paths and names in the controller
Get all interface paths and names in the controller
2022-07-30 08:08:00 【Lost in the forest~deer】
获取controllerAll interface paths and names in
@Autowired
WebApplicationContext applicationContext;
@GetMapping("/getInterfacePath")
public Map getInterfacePath(){
RequestMappingHandlerMapping mapping = applicationContext.getBean(RequestMappingHandlerMapping.class);
// 拿到HandlerAll methods in the adapter
Map<RequestMappingInfo, HandlerMethod> methodMap = mapping.getHandlerMethods();
HashMap<String, String> urlMap = new HashMap<>();
for (RequestMappingInfo info : methodMap.keySet()){
//获取请求路径
Set<String> urlSet = info.getPatternsCondition().getPatterns();
// Get all request methods
//Set<RequestMethod> Methods = info.getMethodsCondition().getMethods();
//Get all request names
String urlName = info.getName();
for (String url : urlSet){
if(StrUtil.isNotBlank(urlName)){
urlMap.put(urlName,url);
}
}
}
return urlMap;
}
The interface name needs to be obtained and needs to be addedname属性
@PostMapping(value = "updateRole", name = "修改用户角色")
接口路径、名称、httpRequest method value path
执行结果:
边栏推荐
猜你喜欢

如何实时计算日累计逐单资金流

LSF提交作业命令--bsub

LVM and disk quotas

MySql详解基础

From catching up to surpassing, domestic software shows its talents

限塑令下的新材料——聚乳酸(PLA)

Pioneer in Distributed Systems - Leslie Lambert

物联网网关该怎么选

MySQL master-slave replication configuration construction, one step in place

Graphical relational database design ideas, this is too vivid
随机推荐
限塑令下的新材料——聚乳酸(PLA)
Boot process and service control
首届人工智能安全大赛正式启动
适合程序员的输入法
go : go-redis list operation
go : create database records using gorm
识别“数据陷阱”,发现数据的可疑之处
学生成绩管理系统(C语言)
go : go-redis list操作
从 Google 离职,前Go 语言负责人跳槽小公司
MySQL基础篇【命名规范】
From catching up to surpassing, domestic software shows its talents
bean的生命周期
Ali two sides: Sentinel vs Hystrix comparison, how to choose?
Upload file -- file type, picture type, document type, video type, compressed package type
AI可通过X光片识别种族,但没人知道为什么
Hex conversion...
Go uses the mencached cache
“AI教练”请进家,家庭智能健身蓬勃发展
General Lei's personal blog to see