美文网首页
spring-7-获取bean的过程

spring-7-获取bean的过程

作者: blank_white | 来源:发表于2020-06-22 19:29 被阅读0次
@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");
    }

相关文章

网友评论

      本文标题:spring-7-获取bean的过程

      本文链接:https://www.haomeiwen.com/subject/hyaowhtx.html