↗ JetBrains 20% discount
Buy any product from JetBrains and get a 20% discount.
Spring MVC
Finding all HandlerMapping registered with Spring context.
@Controllerpublic class TestController { @Autowired ApplicationContext context; @RequestMapping(value = "/test") @ResponseBody public String handleRequest() { Map<String, HandlerMapping> matchingBeans = BeanFactoryUtils.beansOfTypeIncludingAncestors( context, HandlerMapping.class, true, false); matchingBeans .entrySet() .stream() .sorted(Comparator.comparingInt((Map.Entry<String, HandlerMapping> e) -> ((Ordered) e.getValue()).getOrder()) .thenComparing(Map.Entry::getKey)) .forEach(e -> System.out.printf("order:%s %s=%s%n", ((Ordered) e.getValue()).getOrder(), e.getKey(), e.getValue().getClass() .getSimpleName())); return "response from /test"; }}
Finding all HandlerAdapter registered with Spring context.
@Controllerpublic class TestController { @Autowired ApplicationContext context; @RequestMapping(value = "/test") @ResponseBody public String handleRequest() { BeanFactoryUtils .beansOfTypeIncludingAncestors(context, HandlerAdapter.class, true, false) .entrySet() .stream() .sorted(Map.Entry.comparingByKey()) .forEach(e -> System.out.printf("%s=%s%n", e.getKey(), e.getValue().getClass() .getSimpleName())); return "response from /test"; }}