レッスン内容	

package com.example.DiscoverTravelJPA.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.example.DiscoverTravelJPA.service.NewsService;
@Controller
@RequestMapping("/")
public class NewsListController {
	@Autowired
	NewsService newsService;
	@GetMapping
	public String findAll(Model model) {
		model.addAttribute("newsList", newsService.findAll());
		return "index";
	}
}
★@Controller
 コントローラであることを表す
★@RequestMapping(“/”)
 URLを指定、この場合http://localhost:8080 になる
★@GetMapping
 GET送信の際にfindAllメソッドが実行される
★model.addAttribute
 データをHTMLに表示する場合は、Modelにデータを格納しておくため、メソッドの引数にModel型を用意しておく
★return “index”
 returnの後に、表示したいHTMLファイルを拡張子除く形で記述する