【发布时间】:2018-03-23 20:42:09
【问题描述】:
我正在使用 SpringBoot 刷新我的 Spring 技能。我已将库更新到最新版本。当我将浏览器指向应用程序时,出现以下错误:
这是我的控制器:
@Controller
@RequestMapping("/readingList")
public class ReadingListController {
private static final String reader = "russ";
private ReadingListRepository readingListRepository;
@Autowired
public ReadingListController(ReadingListRepository readingListRepository){
this.readingListRepository = readingListRepository;
}
@RequestMapping(value="/{reader})", method={RequestMethod.GET})
public String readersBooks(@PathVariable("reader") String reader, Model model){
List<Book> readingList = readingListRepository.findByReader(reader);
if(readingList != null){
model.addAttribute("books", readingList);
}
return "readingList";
}
@RequestMapping(value="/{reader}", method={RequestMethod.POST})
public String addToReadingList(@PathVariable("reader") String reader, Book book){
book.setReader(reader);
readingListRepository.save(book);
return "redirect:/{reader}";
}
}
tomcat 日志如下所示:
任何建议或建议将不胜感激。
罗斯
【问题讨论】: