- 
                Notifications
    You must be signed in to change notification settings 
- Fork 38.8k
Closed
Closed
Copy link
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug
Milestone
Description
Christopher Smith opened SPR-12975 and commented
The handler-mapping builder is adding an extra slash to the beginning of handler mappings, causing MockMvc tests to fail because of strict matching in MockMvc.
@Controller
@CompileStatic
@RequestMapping("/")
class StaticPagesHtmlController {
    @RequestMapping("")
    public String home() {
        "index2"
    }
    @RequestMapping("about")
    String aboutMain() {
        "about/index"
    }
}2015-05-04 01:37:09.954  INFO   --- [           main] ilder$StaticRequestMappingHandlerMapping : Mapped "{[/],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.artsquare.gallery.web.html.StaticPagesHtmlController.home()
2015-05-04 01:37:09.954  INFO   --- [           main] ilder$StaticRequestMappingHandlerMapping : Mapped "{[//about],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.artsquare.gallery.web.html.StaticPagesHtmlController.aboutMain()
It looks like a potential defensive rule that adds the slash to the root-root mapping is also adding erroneous, breaking, slashes to the other mappings.
Affects: 4.1.6
Issue Links:
- MockMvc isn't matching handler mappings [SPR-12976] #17567 MockMvc isn't matching handler mappings
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug