All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.bingoohuang.springrestclient.spring.SpringRestClientFactoryBean Maven / Gradle / Ivy

There is a newer version: 0.0.23
Show newest version
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