1 Controller의 작성
2 BoardController의 작성
org.zerock.controller.BoardController.java
package org.zerock.controller;
import org.springframework.stereotype.Controller;
import org.zerock.service.BoardService;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
@Controller
@Log4j2
@RequestMapping("/board/*")
@AllArgsConstructor
public class BoardController {
private BoardService service;
}
servlet-context.xml
<context:component-scan base-package="org.zerock.controller" />
org.zerock.controller.BoardController.java
@GetMapping("/list")
public void list(Model model) {
log.info("list");
model.addAttribute("list", service.getList());
}