How to show all available routes in Spring?

后端 未结 2 690
心在旅途
心在旅途 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]
    

提交回复
热议问题