Spring mvc 白标签错误页此应用程序没有/Error的显式映射,因此您将其视为回退
我正在用SpringBoot刷新我的Spring技能。我已将库更新到最新版本。当我将浏览器指向应用程序时,出现以下错误: 这是我的控制器:Spring mvc 白标签错误页此应用程序没有/Error的显式映射,因此您将其视为回退,spring-mvc,spring-boot,Spring Mvc,Spring Boot,我正在用SpringBoot刷新我的Spring技能。我已将库更新到最新版本。当我将浏览器指向应用程序时,出现以下错误: 这是我的控制器: @Controller @RequestMapping("/readingList") public class ReadingListController { private static final String reader = "russ"; private ReadingListRepository readingListRepository
@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}";
}
@控制器
@请求映射(“/readingList”)
公共类ReadingListController{
私有静态最终字符串读取器=“russ”;
私有ReadingListRepository ReadingListRepository;
@自动连线
公共ReadingListController(ReadingListRepository ReadingListRepository){
this.readingListRepository=readingListRepository;
}
@RequestMapping(value=“/{reader})”,method={RequestMethod.GET})
公共字符串读取器书籍(@PathVariable(“reader”)字符串读取器,模型){
List readingList=readingListRepository.findByReader(reader);
if(readingList!=null){
model.addAttribute(“书籍”,阅读列表);
}
返回“readingList”;
}
@RequestMapping(value=“/{reader}”,method={RequestMethod.POST})
公共字符串addToReadingList(@PathVariable(“reader”)字符串读取器,Book Book){
书.集阅读器(阅读器);
readingListRepository.save(book);
返回“重定向:/{reader}”;
}
}
tomcat日志如下所示:
如有任何建议,将不胜感激
Russ只是语法错误
删除
)
中的value=“/{reader})”
非常感谢!我需要检查一下眼镜