前提・実現したいこと
SpringBootで開発中、localhostに接続すると404エラーが表示されてしまいます。
SpringBoot自体は問題なく起動していまして、どこに問題があるのかわかりません。
ご教示いただけると助かります。よろしくお願いします。
発生している問題・エラーメッセージ
ブラウザの404エラーメッセージです。
Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Fri Jul 20 15:55:08 JST 2018 There was an unexpected error (type=Not Found, status=404). No message available
該当のソースコード
Controller.java
package com.example.web.controller; import com.example.business.Todo; import com.example.business.domain.TodoRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import java.util.List; @Controller public abstract class TodoController { @Autowired private TodoRepository todoRepository; @RequestMapping(value = "/", method = RequestMethod.GET) public ModelAndView index(ModelAndView mav){ List<Todo> todo = todoRepository.findAll(); mav.addObject("todo", todo); mav.setViewName("todo/index"); return mav; } }
index.html
<!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <title>Todolist</title> </head> <body> (中略) </body> </html>
試したこと
・thymeleafの依存関係があることは確認しました。
・一度HelloWorld!だけ表示させるプログラムに書き換えてみましたが404でした。
補足情報(FW/ツールのバージョンなど)
SpringBoot2.0.3RELEASE(gradle使用)
テンプレートエンジンはThymeleaf
intelliJ IDEA利用
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/07/20 08:44