@Autowired private RequestMappingHandlerMapping handlerMapping; @Test public void getAllApi() { Map<RequestMappingInfo, HandlerMethod> map = this.handlerMapping.getHandlerMethods(); Set<RequestMappingInfo> set = map.keySet(); for (RequestMappingInfo info : set) { HandlerMethod handlerMethod = map.get(info); // springmvc的url地址,不包含项目名 PatternsRequestCondition patternsCondition = info.getPatternsCondition(); System.out.println(patternsCondition); } System.out.println(111); }