package com.lovecoding.mvc; import com.lovecoding.mvc.doman.Book; import com.lovecoding.mvc.mapper.BookMapper; import com.lovecoding.mvc.service.BookService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.ResponseBody; import java.util.List; @Controller public class MybatisTestController { @Autowired BookService bookService; @GetMapping("/mybatis") @ResponseBody public Book test(){ Book book = bookService.get(1L); System.out.println( book ); return book; } }