18. @Controller
@RequestMapping("/boards")
public class BoardController {
@ResponseBody //
@RequestMapping(method = RequestMethod.POST)
public Board post(@RequestBody Board board) {};
@ResponseBody // 譟壱
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public Board get(@PathVariable("id") Long boardId) {};
@ResponseBody //
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public Board put(@PathVariable("id") Long boardId,
@RequestBody Contents contents) {};
@ResponseBody //
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public void post(@PathVariable("id") Long boardId) {};
}
Controller
19. @Service
@Transactional
public class BoardService {
public Board new(Board board){}; //
public Board get(Long boardId){}; // 譟壱
public Board update(Board board){}; //
public void remove(Long boardId){}; //
}
Service