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

com.github.nezha.httpfetch.spring.HttpApiFactoryBean Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
package com.github.nezha.httpfetch.spring;

import com.github.nezha.httpfetch.HttpApiService;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by daiqiang on 17/7/26.
 */
public class HttpApiFactoryBean implements FactoryBean {

    @Autowired
    private HttpApiService httpApiService;

    private Class targetClass;

    @Override
    public Object getObject() throws Exception {
        return httpApiService.getOrCreateService(targetClass);
    }

    @Override
    public Class getObjectType() {
        return targetClass;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }

    public Class getTargetClass() {
        return targetClass;
    }

    public void setTargetClass(Class targetClass) {
        this.targetClass = targetClass;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy