How to show all available routes in Spring?

后端 未结 2 689
心在旅途
心在旅途 2021-02-07 09:45

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:

相关标签:
2条回答
  • 2021-02-07 10:16

    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]
    
    0 讨论(0)
  • 2021-02-07 10:18

    If you are using Intellij (ultimate edition), then after you build/run the project, you can view the routes in the bottom toolbar Run -> Endpoints -> Mappings.

    0 讨论(0)
提交回复
热议问题