从指定的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);
        }

 

上一篇:Autowired Resource


下一篇:ECharts公共组件:title详解、 tooltip详解、toolbox详解、legend详解、dataZoom详解、visualMap全解