In my application, I have a situation where spring mvc sequentially selects the wrong controller method to execute. the debug log from spring below shows the problem, it finds two matches, one for my general purpose, processes the entire unhanded display controller that maps to /api/** , and one for the actual thing I'm looking for api/companies/2/records/cabinets/FileTypes/50/1 spring mvc then selects the /api/** handler for the more specific handler that it found.
My understanding of spring is that if there are two matches for matching requests, then spring will choose a descriptor method with a longer URL. Why does spring mvc choose a shorter display?
Given the following mappings:
/api/companies/{id}/records/cabinets/FileTypes/{fileTypeId}/{versionId} associated with method1/api/** mapped to method2
And the api/companies/2/records/cabinets/FileTypes/50/1 path, which spring mvc should choose as the handler method for the two above URLs.
here the corresponding lines form the debug log.
17:58:49,858 DEBUG [DispatcherServlet] DispatcherServlet with name 'main' processing PUT request for [/web/api/companies/2/records/cabinets/FileTypes/50/1] 17:58:49,858 TRACE [DispatcherServlet] Testing handler map [org.springframework .web.servlet.mvc.method.annotation.RequestMappingHandlerMapping@ 2b25f2be] in DispatcherServlet with name 'main' 7:58:49,858 DEBUG [RequestMappingHandlerMapping] Looking up handler method for path /api/companies/2/records/cabinets/FileTypes/50/1 17:58:49,859 TRACE [RequestMappingHandlerMapping] Found 2 matching mapping(s) for [/api/companies/2/records/cabinets/FileTypes/50/1] : [{[/api
source share