tags:

views:

17

answers:

1

How to show all the routes mapped in a spring based application? In rails this is done using rake routes.

I use two mapping methods of spring to create the url-mappings:

  • @RequestMapping
  • SimpleUrlHandler

I have used the unix command grep and cut to get all the mappings of @RequestMapping. I wonder if there is some way i can get these details from the spring application.

A: 

If you set the Log4J category for log4j.logger.org.springframework.web to INFO or DEBUG you should see the list of mappings in your server's log (e.g. catalina.out) when your app starts up. For example:

INFO: DefaultAnnotationHandlerMapping: Mapped URL path [/about] onto handler [org.bozos.songfight.webapp.spring.controller.RootController@6bc947]
INFO: DefaultAnnotationHandlerMapping: Mapped URL path [/about.*] onto handler [org.bozos.songfight.webapp.spring.controller.RootController@6bc947]
INFO: DefaultAnnotationHandlerMapping: Mapped URL path [/about/] onto handler [org.bozos.songfight.webapp.spring.controller.RootController@6bc947]
...
INFO: SimpleUrlHandlerMapping: Mapped URL path [/login] onto handler [org.springframework.web.servlet.mvc.UrlFilenameViewController@4035acf6]
sdouglass