Constructor-based Dependency Injection(基于构造器的依赖注入)
public class UserServiceImpl implements UserService { private UserDao userDao; public void setUserDao(UserDao userdao) { this.userDao=userdao; } public void getUser() { userDao.getUser(); } }
2023-11-15 17:31:34
public class UserServiceImpl implements UserService { private UserDao userDao; public void setUserDao(UserDao userdao) { this.userDao=userdao; } public void getUser() { userDao.getUser(); } }