@Autowired
private RequestMappingHandlerMapping handlerMapping;
public Method getHandlerMethod(String url) {
HandlerExecutionChain chain = handlerMapping.getHandler(url);
HandlerMethod handlerMethod = (HandlerMethod) chain.getHandler();
return handlerMethod.getMethod();
}
springboot用url获得对应的controller方法
最新推荐文章于 2024-12-27 16:01:46 发布
本文详细解释了如何在SpringMVC中使用@Autowired注解和RequestMappingHandlerMapping获取处理器方法,包括getHandlerMethod函数的作用和处理流程。
1007

被折叠的 条评论
为什么被折叠?



