spring-7-获取bean的过程

2020-06-22  本文已影响0人  blank_white
@Test
    public void test1(){
        String config="applicationContext.xml";
        //通过 类的存放路径
        ApplicationContext cxt=new ClassPathXmlApplicationContext(config);
        //通过 文件系统的路径
        //ApplicationContext cx2=new FileSystemXmlApplicationContext(config);
        SomeServer server= (SomeServer) cxt.getBean("server");
        server.doSome(1,"asd");
    }
上一篇 下一篇

猜你喜欢

热点阅读