6

Is there a way to see all @RequestMapping annotations as map of all requests/URLs, ideally with quick links to whichever Controller/method handles the URL?

In Spring 2 (before annotations) XML config (SimpleUrlHandlerMapping) could be used as such reference, now with annotated controllers is there any other way besides searching the codebase?

Panagiotis Bougioukos
  • 15,955
  • 2
  • 30
  • 47
Aramir
  • 317
  • 2
  • 9
  • I have previously provided an answer here: http://stackoverflow.com/questions/11082818/spring-mvc-get-all-request-mappings/11083493#11083493, see if this still helps you. Another option if you are using Spring-boot will be to use spring-boot-actuator with /mappings ready made endpoint – Biju Kunjummen Jun 24 '14 at 01:52
  • I was thinking about an Intellij IDEA plugin or something similar to that, integrated into IDE. The need to deploy/start an application to see the list of mapped controllers seems similarly inconvenient to running a context search. Thanks for the suggestion, though - it's a neat trick. – Aramir Jun 24 '14 at 02:25
  • plugin `request-mapper` is exactly your friend, shotcut `shift, ctrl, \\`. https://plugins.jetbrains.com/plugin/9567-request-mapper – Tiina Sep 29 '17 at 02:19
  • 1
    If using IDEA, you may need this plugin. https://plugins.jetbrains.com/plugin/10292-restfultoolkit – shuai yan Mar 03 '20 at 08:05

2 Answers2

7

yes we can do the same as we can see that in STS spring explore , coming to intellij Go to Project Structure >> Modules >> select your project and add Spring to your project .

This will give you a spring tab at the bottom to see all the controllers.

BSrinivas
  • 118
  • 2
  • 8
  • 1
    Yes, already figured that out. Warning to anyone else who has problems with this - there is a bug in current version of IDEA (13.x) - when you edit any of the autodetected facets for Spring (so they stop being autodetected and become "saved" ones) this effectively kills IDEA detecting the Web contexts and shows nothing in the Spring/MVC tab. – Aramir Jul 16 '14 at 07:15
1

2021 update: you can download a popular plugin in Intelij called Request mapper.

Currently it supports both Spring and JAX-RS path mappings.

request mapper plugin

Panagiotis Bougioukos
  • 15,955
  • 2
  • 30
  • 47