1.写上注解 @Autowired 2.声明一个变量 private UserDao userDao; 3.注意!Spring里面数据库对象操作类不需要实例化就能调用 转载于:https://www.cnblogs.com/max-hou/p/11104738.html