6. CartController 클래스에 장바구니에 등록하는 addCartByNewItem() 메서드를 추가로 작성합니다.
코드 14-16 CartController.java
package com.springmvc.controller;
...
import com.springmvc.domain.Book;
import com.springmvc.service.BookService;
import com.springmvc.exception.BookIdException;
import com.springmvc.domain.CartItem;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@Controller
@RequestMapping(value="/cart")
public class CartController {
@Autowired
private CartService cartService;
@Autowired
private BookService bookService;
...