简单的说想在main函数中调用service的一个方法adduser,
public boolean adduser(User user){
this.getSqlMapClientTemplate().insert("User.adduser", user);
}service中注入了sqlmapclient
所以不能直接实例化,请问各位,这么要这么实现
public boolean adduser(User user){
this.getSqlMapClientTemplate().insert("User.adduser", user);
}service中注入了sqlmapclient
所以不能直接实例化,请问各位,这么要这么实现
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
ServiceBean service= (ServiceBean) ctx.getBean("serviceID");
凡是在spring xml文件中定义好的Bean,可以从ApplicationContext上取出来。