10111213141516171819202122
public static void main(String[] args) { ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml"); UserDao dao=(UserDao) ctx.getBean("userDao"); User u=new User(); u.setUsername("aa"); u.setRole("admin"); u.setPassword("111"); dao.save(u); }