
com.github.bingoohuang.springrestclient.spring.SpringRestClientFactoryBean Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-rest-client Show documentation
Show all versions of spring-rest-client Show documentation
convenient spring rest client for rest services
package com.github.bingoohuang.springrestclient.spring;
import com.github.bingoohuang.springrestclient.generators.SpringRestClientFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
public class SpringRestClientFactoryBean implements FactoryBean, ApplicationContextAware {
private Class interfaceClazz;
private ApplicationContext appContext;
public void setInterfaceClazz(Class interfaceClazz) {
this.interfaceClazz = interfaceClazz;
}
@Override
public T getObject() throws Exception {
return SpringRestClientFactory.getRestClient(interfaceClazz, appContext);
}
@Override
public Class> getObjectType() {
return this.interfaceClazz;
}
@Override
public boolean isSingleton() {
return true;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.appContext = applicationContext;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy