从指定的xml配置文件中获取bean

        ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();

        Resource resource = resourcePatternResolver.getResource("classpath:META-INF/spring/sofa-rpc-consumer.xml");
        System.out.println(resource.getURL());

        DefaultListableBeanFactory defaultListableBeanFactory = new DefaultListableBeanFactory();

        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(defaultListableBeanFactory);
        reader.loadBeanDefinitions(resource);

        String[] beans = defaultListableBeanFactory.getBeanDefinitionNames();
        for (String s: beans) {
            System.err.println(s);
        }

 

从指定的xml配置文件中获取bean

上一篇:蛇形矩阵


下一篇:Required request body is missing-请求接口报错