Announcement Announcement Module
Collapse
No announcement yet.
Multiple DefaultAnnotationHandlerMapping in spring config file? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple DefaultAnnotationHandlerMapping in spring config file?

    Hi,

    is it possible to define multilpe DefaultAnnotationHandlerMapping beans?

    I would like to define two of them(one with interceptors, one without).

    If this is possible, how do I specify which controllers are handled by DefaultAnnotationHandlerMapping A and DefaultAnnotationHandlerMapping B?

    Kind regards,

    Nicolas

  • #2
    Hi,

    is there anyone with a solution for this problem?

    Kind regards,

    Nicolas

    Comment


    • #3
      There doesn't seem to be a way to configure that. There are other handler mapping strategies you can use besides the DefaultAnnotationHandlerMapping. For example the ControllerClassNameHandlerMapping. It works in combination with method-relative @RequestMapping annotations.

      For example:
      /pet/show -> PetController.show()

      where

      Code:
      @Controller
      public class PetController {
          
          @RequestMapping
          public void show() {
              ...
          }
      
      }
      This has the advantage of making it easy to find the controller method given a URL, something that's much harder to guess with an all annotations approach.

      Comment


      • #4
        This feature request might help you, if so you can vote for it:

        Allow multiple DefaultAnnotationHandlerMapping beans - move AbstractControllerUrlHandlerMapping.isEligibleForM apping(..) to AbstractDetectingUrlHandlerMapping
        http://jira.springframework.org/browse/SPR-5576

        Comment

        Working...
        X