当前位置:网站首页>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
执行结果:
边栏推荐
- 预测人们对你的第一印象,“AI颜狗”的诞生
- sql concat()函数
- MySQL题外篇【ORM思想解析】
- redis实现分布式锁的原理
- export , export default, import complete usage
- From catching up to surpassing, domestic software shows its talents
- How to understand plucker coordinates (geometric understanding)
- Is it possible to use the same port for UDP and TCP?
- Go 使用mencached缓存
- Go 使用 freecache 缓存
猜你喜欢

ETL为什么经常变成ELT甚至LET?

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

RAID disk array

华为发布“十大发明”,包含计算、智能驾驶等新领域

From catching up to surpassing, domestic software shows its talents

首届人工智能安全大赛正式启动

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

redis实现分布式锁的原理

2020 ACM | MoFlow: An Invertible Flow Model for Generating Molecular Graphs

Keil软件中map文件解析
随机推荐
Upload file -- file type, picture type, document type, video type, compressed package type
No, the Log4j vulnerability hasn't been fully fixed yet?
The terminal connection tools, rolling Xshell
适合程序员的输入法
The first artificial intelligence safety competition officially launched
MySQL basics [naming convention]
从追赶到超越,国产软件大显身手
这个终端连接工具,碾压Xshell
selenium模块
go : go-redis set operations
k8s 部署mysql8(PV和PVC 版本)
让百度地图生成器里的“标注”内容展开--解决方案
Go uses freecache for caching
go : use gorm to modify data
阿里二面:Sentinel vs Hystrix 对比,如何选择?
分布式系统中的开创者—莱斯利·兰伯特
什么是微服务?
Playing script killing with AI: actually more involved than me
sizeof
使用navicat连接mysql数据库时常报的错误:2003、1698、1251