1 Controller의 작성

2 BoardController의 작성

Untitled

Untitled

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;

}

Controller Scan 확인

<context:component-scan base-package="org.zerock.controller" />

Untitled

org.zerock.controller.BoardController.java

@GetMapping("/list")
	 public void list(Model model) {
	
	 log.info("list");
	 model.addAttribute("list", service.getList());
	
	 }