Skip to content

Cannot map handler - There is already handler with @Controller and not unique requestMappings [SPR-5697] #10367

@spring-projects-issues

Description

@spring-projects-issues

Bertalan Fodor opened SPR-5697 and commented

Using context:component-scan with @Controller annotation I get automatic mappings.
For example:

@Controller
public class FormController becomes: /form/*

If I have a request handler in FormController like

@RequestMapping("init.do")
public String init() { }

it gets mapped to /form/init.do
Alright this way.
But if I create another controller like

@Controller public class ContactController { 

    @RequestMapping("init.do")
    public String init() { }

}

it isn't mapped to /contact/init.do as I would expect, but throws the error:
Cannot map handler [formController] to URL path [init.do]: There is already handler [com.company.FormController@f8b79a] mapped.


Affects: 2.5.6

1 votes, 1 watchers

Metadata

Metadata

Assignees

Labels

status: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions