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

com.cloudimpl.outstack.spring.service.ServiceProxyBeanFactory Maven / Gradle / Ivy

There is a newer version: 4.0.551
Show newest version
package com.cloudimpl.outstack.spring.service;

import com.cloudimpl.outstack.spring.component.Cluster;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.lang.reflect.Proxy;

import static com.cloudimpl.outstack.spring.service.ServiceProxyBeanFactory.SERVICE_PROXY_BEAN_FACTORY;

/**
 * Dynamic proxy instance creation factory
 */
@Component(SERVICE_PROXY_BEAN_FACTORY)
public class ServiceProxyBeanFactory {
    public static final String SERVICE_PROXY_BEAN_FACTORY = "serviceProxyBeanFactory";

    @Autowired
    private Cluster cluster;


    public ServiceProxyBeanFactory() {
    }

    @SuppressWarnings("unused")
    public  T createServiceProxyBean(Class beanClass) {

        return (T)Proxy.newProxyInstance(beanClass.getClassLoader(),new Class[]{beanClass},new ReactiveServiceProxyHandler(beanClass,cluster));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy