Guest User

Untitled

a guest
Jan 22nd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. @RequestMapping(name="/quiz/questions/{quizId}", method=RequestMethod.GET)
  2. public ResponseEntity<QuizQuestion> questions(@PathVariable String quizId) {
  3. QuizQuestion question = this.quizService.fetchQuestion(quizId);
  4. if (question == null) {
  5. return new ResponseEntity<QuizQuestion>(HttpStatus.NOT_FOUND);
  6. }
  7. return new ResponseEntity<QuizQuestion>(question, HttpStatus.OK);
  8. }
  9.  
  10. @RequestMapping(name="/quiz/score/{id}", method=RequestMethod.GET)
  11. public Score getScore(@PathVariable("id") String quizId) {
  12. return this.quizService.getScore(quizId);
  13. }
  14.  
  15. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map '/myapplication' method
  16. public com.project.myapplication.Score com.project.myapplication.QuizController.getScore(java.lang.String)
  17. to {[],methods=[GET]}: There is already '/myapplication' bean method
  18. public org.springframework.http.ResponseEntity<com.project.myapplication.QuizQuestion> com.project.myapplication.QuizController.questions(java.lang.String) mapped.
  19. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
  20.  
  21. . . . . . . . .. .
  22.  
  23. Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map '/myapplication' method
  24. public com.project.myapplication.Score com.project.myapplication.QuizController.getScore(java.lang.String)
  25. to {[],methods=[GET]}: There is already '/myapplication' bean method
  26. public org.springframework.http.ResponseEntity<com.project.myapplication.QuizQuestion> com.project.myapplication.QuizController.questions(java.lang.String) mapped.
  27. at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry.assertUniqueMethodMapping(AbstractHandlerMethodMapping.java:576) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]
  28. at
  29.  
  30. @RequestMapping(name="/quiz/score/{id}", method=RequestMethod.GET)
  31. public Score getScore(@PathVariable("id") String quizId) {
  32. return this.quizService.getScore(quizId);
  33. }
  34.  
  35. @RequestMapping(value="/quiz/score/{id}", method=RequestMethod.GET)
  36. public Score getScore(@PathVariable("id") String quizId) {
  37. return this.quizService.getScore(quizId);
  38. }
Add Comment
Please, Sign In to add comment