gistfile1.txt package org.jxnd.test;import java.security.Provider.Service;import javax.tools.Tool;import org.jxnd.bean.BaseBean;import org.jxnd.bean.Roles;import org.jxnd.bean.UserInfo;import org.jxnd.tools.Tools;import org.springframework.
package org.jxnd.test; import java.security.Provider.Service; import javax.tools.Tool; import org.jxnd.bean.BaseBean; import org.jxnd.bean.Roles; import org.jxnd.bean.UserInfo; import org.jxnd.tools.Tools; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class Test { //IOC:控制反转,依赖注入 //原本由程序员来创建的对象,现在变成由spirng的ioc来管理(创建,销毁) //Service依赖Dao层,所以Service要new Dao层,现在使用ioc Service不需要new Dao层,直接通过容器获取 //运行效率 public static void main(String[] args) { ApplicationContext context=new ClassPathXmlApplicationContext("spring_application2.xml"); Tools info=context.getBean(Tools.class); info.getUser(); } }