io.katharsis.spring.SpringServiceLocator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of katharsis-spring Show documentation
Show all versions of katharsis-spring Show documentation
Katharsis Spring integration
package io.katharsis.spring;
import io.katharsis.locator.JsonServiceLocator;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
public class SpringServiceLocator implements BeanFactoryAware, JsonServiceLocator {
private ConfigurableBeanFactory beanFactory;
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
if (beanFactory instanceof ConfigurableBeanFactory) {
this.beanFactory = (ConfigurableBeanFactory) beanFactory;
}
}
@Override
public T getInstance(Class clazz) {
return beanFactory.getBean(clazz);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy