wkennedy / swagger4spring-web

Swagger support for Spring MVC
89 stars 46 forks source link

cannot have multiple controllers bound to the same URL #53

Closed rburgst closed 10 years ago

rburgst commented 10 years ago

I have multiple controllers which are bound to the same base url

@Controller 
@RequestMapping("/reservation")
public class ReservationController {
    @RequestMapping("/")
    ...
}

@Controller 
@RequestMapping("/reservation")
public class ReservationFormController {
    @RequestMapping("/edit")
    ...
}

In such a case the 2nd controller is ignored, the reason seems to be that the api listings are stored in a hash map based on their URLs. So newer controllers will override the apilisting created for a previous controller.

IMHO the apilistings need to be merged.

MIhirMishra commented 9 years ago

I have a scenario like: 'GET' on '/resource/{id}/collection' and 'POST' on '/resource/{id}/collection'. The behavior, reason(and frequency) to change these methods are so different that I want to put these methods into different classes as only of these classes change frequently('SRP'). If Http verb(get, post) is taken into consideration as well while deciding controller that will help IMHO. Thank you!