Spring MVC Mapping problem

后端 未结 1 723
感情败类
感情败类 2020-12-07 03:36

I have what I thought was a simple Spring MVC app. However, I can seem to set the requestMappings correctly. What\'s strange is that the logs show that the url is mapped t

1条回答
  •  北海茫月
    2020-12-07 04:03

    You shouldn't duplicate "/app" in both @RequestMapping and . That is, your sayHello now is mapped to "/app/app/index". You can write

    @RequestMapping(value = "/index", method = RequestMethod.GET)
    

    (Or you can declare DefaultAnnotationHandlerMapping bean in your config and set its allwaysUseFullPath property to true to override default behavior)

    0 讨论(0)
提交回复
热议问题