We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keith Donald opened SPR-5731 and commented
Works:
@Controller @RequestMapping("/appointments") public class AppointmentsController { private AppointmentBook appointmentBook; @Autowired public AppointmentsController(AppointmentBook appointmentBook) { this.appointmentBook = appointmentBook; } @RequestMapping(value="/new", method = RequestMethod.GET) public AppointmentForm getNewForm() { return new AppointmentForm(); } @RequestMapping(value="/{day}", method = RequestMethod.GET) public Appointments getForDay(@PathVariable Date day) { return appointmentBook.getAppointmentsForDay(day); } }
Does not work:
@Controller @RequestMapping("/appointments") public class AppointmentsController { private AppointmentBook appointmentBook; @Autowired public AppointmentsController(AppointmentBook appointmentBook) { this.appointmentBook = appointmentBook; } @RequestMapping(value="/{day}", method = RequestMethod.GET) public Appointments getForDay(@PathVariable Date day) { return appointmentBook.getAppointmentsForDay(day); } @RequestMapping(value="/new", method = RequestMethod.GET) public AppointmentForm getNewForm() { return new AppointmentForm(); } }
Specifically, a GET to /appointments/new results in:
java.lang.IllegalStateException: Could not find @PathVariable [day] in @RequestMapping org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.resolvePathVariable(AnnotationMethodHandlerAdapter.java:644) org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolvePathVariable(HandlerMethodInvoker.java:514) org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:262) org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:146) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:355) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:343) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:763) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:709) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:614) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:526) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:195) org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:159) org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141) org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90) org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:417)
... indicating the {day} mapped method ran instead of the /new method. With the method order reversed, GET /appointments/new works as expected.
Affects: 3.0 M3
Issue Links:
Referenced from: commits 752832a
The text was updated successfully, but these errors were encountered:
Arjen Poutsma commented
As a workaround, while I work on this, you can provide the full path in the @RequestMapping. I.e.
@RequestMapping
@RequestMapping("/appointments/new") @RequestMapping("/appointments/{day}")
That works.
Sorry, something went wrong.
poutsma
No branches or pull requests
Keith Donald opened SPR-5731 and commented
Works:
Does not work:
Specifically, a GET to /appointments/new results in:
... indicating the {day} mapped method ran instead of the /new method. With the method order reversed, GET /appointments/new works as expected.
Affects: 3.0 M3
Issue Links:
Referenced from: commits 752832a
The text was updated successfully, but these errors were encountered: