Class TenantedProxyFactory

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware

    public final class TenantedProxyFactory
    extends Object
    implements org.springframework.beans.factory.BeanFactoryAware
    Responsible for creating proxy objects which check the tenancy state of the application before handing over to either a tenanted or vacant delegate.
    Since:
    7.5
    • Constructor Detail

      • TenantedProxyFactory

        public TenantedProxyFactory​(TenantRegistry tenantRegistry)
    • Method Detail

      • createProxy

        public <T> T createProxy​(Class<T> beanType,
                                 String tenantedDelegateBeanName,
                                 String vacantDelegateBeanName)
        Create a tenancy-aware proxy for a given target type, which delegates to either one of two target beans depending on tenancy state.
        Parameters:
        beanType - The common type of the delegate beans
        tenantedDelegateBeanName - The name of the delegate bean to be used when there is a tenant
        vacantDelegateBeanName - The name of the delegate bean to use when there isn't a tenant
      • createProxy

        public <T> T createProxy​(Class<T> beanType,
                                 String tenantedDelegateBeanName)
        Create a tenancy-aware proxy for a given target type, which delegates to a designed target bean if there is a tenant, or throws an exception if there isn't.
        Parameters:
        beanType - The common type of the delegate beans
        tenantedDelegateBeanName - The name of the delegate bean to be used when there is a tenant
      • setBeanFactory

        public void setBeanFactory​(org.springframework.beans.factory.BeanFactory beanFactory)
                            throws org.springframework.beans.BeansException
        Specified by:
        setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
        Throws:
        org.springframework.beans.BeansException