作者:灰太狼老婆红太狼_715 | 来源:互联网 | 2023-08-22 15:24
packageioc1.it.dao;publicclassuserDaoImplimplementsuserDao{publicuserDaoImpl(){System.out.
package ioc1.it.dao;
public class userDaoImpl implements userDao {
public userDaoImpl() {
System.out.println("无参");
}
@Override
public void save() {
System.out.println("kachaq");
}
}
private userDao userDao;
public void setUserDao(ioc1.it.dao.userDao userDao) {
this.userDao = userDao;
}
public void save(){
userDao.save();
}
public static void main(String[] args) {
ClassPathXmlApplicationContext app = new ClassPathXmlApplicationContext("applicationContext.xml");
service service = (service)app.getBean("service");
service.save();
}