mapper包的编写
controller采取全注解开发
@Controller//标注为一个控制器
@RequestMapping("/book")//设置高一级路径
public class BookController {
@Autowired//自动装填
@Qualifier("bookServiceImpl")//指定装填
private BookService bookService;
@RequestMapping("/findAll")//调用路径
public String list(Model model){
List<Books> allBooks = bookService.findAllBooks();
model.addAttribute("bookList",allBooks);
return "test";
}
service采用注解开发
@Component 注册bean到spring管理