Results 1 to 4 of 4

Thread: Multiple DefaultAnnotationHandlerMapping in spring config file?

  1. #1
    Join Date
    Nov 2008
    Posts
    5

    Default 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. #2
    Join Date
    Nov 2008
    Posts
    5

    Default

    Hi,

    is there anyone with a solution for this problem?

    Kind regards,

    Nicolas

  3. #3
    Join Date
    Aug 2006
    Location
    Brooklyn
    Posts
    556

    Default

    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.

  4. #4
    Join Date
    Dec 2004
    Location
    London
    Posts
    37

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •