use of org.springframework.beans.factory.ListableBeanFactory in project ignite by apache.
the class GridJobLoadTest method startNode.
/**
* Starts new grid node.
*
* @param igniteInstanceName name of new node.
* @param springCfg file with spring configuration to use for this node.
* @return a grid instance local to new node {@link org.apache.ignite.Ignition#start(org.apache.ignite.configuration.IgniteConfiguration)}.
* @throws Exception if node run failed.
*/
protected Ignite startNode(String igniteInstanceName, File springCfg) throws Exception {
assert springCfg != null;
ListableBeanFactory springCtx = new FileSystemXmlApplicationContext("file:///" + springCfg.getAbsolutePath());
Map cfgMap = springCtx.getBeansOfType(IgniteConfiguration.class);
assert cfgMap != null;
assert !cfgMap.isEmpty();
IgniteConfiguration cfg = (IgniteConfiguration) cfgMap.values().iterator().next();
cfg.setIgniteInstanceName(igniteInstanceName + "-" + getNextNodeNum());
return G.start(cfg);
}
use of org.springframework.beans.factory.ListableBeanFactory in project camel by apache.
the class CamelCommandsPlugin method init.
@Override
public void init() {
ListableBeanFactory beanFactory = (ListableBeanFactory) getContext().getAttributes().get("spring.beanfactory");
this.facade = new CamelCommandsFacade(new CamelControllerImpl(beanFactory));
setCamelPlugin(this);
}
use of org.springframework.beans.factory.ListableBeanFactory in project spring-framework by spring-projects.
the class SchedulerAccessorBean method findScheduler.
protected Scheduler findScheduler(String schedulerName) throws SchedulerException {
if (this.beanFactory instanceof ListableBeanFactory) {
ListableBeanFactory lbf = (ListableBeanFactory) this.beanFactory;
String[] beanNames = lbf.getBeanNamesForType(Scheduler.class);
for (String beanName : beanNames) {
Scheduler schedulerBean = (Scheduler) lbf.getBean(beanName);
if (schedulerName.equals(schedulerBean.getSchedulerName())) {
return schedulerBean;
}
}
}
Scheduler schedulerInRepo = SchedulerRepository.getInstance().lookup(schedulerName);
if (schedulerInRepo == null) {
throw new IllegalStateException("No Scheduler named '" + schedulerName + "' found");
}
return schedulerInRepo;
}
use of org.springframework.beans.factory.ListableBeanFactory in project spring-boot by spring-projects.
the class ConfigurationPropertiesBindingPostProcessor method getSinglePropertySourcesPlaceholderConfigurer.
private PropertySourcesPlaceholderConfigurer getSinglePropertySourcesPlaceholderConfigurer() {
// Take care not to cause early instantiation of all FactoryBeans
if (this.beanFactory instanceof ListableBeanFactory) {
ListableBeanFactory listableBeanFactory = (ListableBeanFactory) this.beanFactory;
Map<String, PropertySourcesPlaceholderConfigurer> beans = listableBeanFactory.getBeansOfType(PropertySourcesPlaceholderConfigurer.class, false, false);
if (beans.size() == 1) {
return beans.values().iterator().next();
}
if (beans.size() > 1 && logger.isWarnEnabled()) {
logger.warn("Multiple PropertySourcesPlaceholderConfigurer " + "beans registered " + beans.keySet() + ", falling back to Environment");
}
}
return null;
}
use of org.springframework.beans.factory.ListableBeanFactory in project spring-boot by spring-projects.
the class ResourceServerPropertiesTests method setListableBeanFactory.
private void setListableBeanFactory() {
ListableBeanFactory beanFactory = new StaticWebApplicationContext() {
@Override
public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
if (type.isAssignableFrom(ResourceServerTokenServicesConfiguration.class)) {
return new String[] { "ResourceServerTokenServicesConfiguration" };
}
return new String[0];
}
};
this.properties.setBeanFactory(beanFactory);
}
Aggregations