Class LazyServiceFactoryBean

java.lang.Object
org.kuali.rice.ksb.api.bus.support.LazyServiceFactoryBean
All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<Object>, org.springframework.beans.factory.InitializingBean

public class LazyServiceFactoryBean extends Object implements org.springframework.beans.factory.FactoryBean<Object>, org.springframework.beans.factory.InitializingBean
Loads a lazy proxy to a service from the ServiceBus. This proxy is created based on either the proxy interfaces that are injected into this bean, or derived from the objectType which is injected into this bean. If neither of these are injected, then an exception will be through during bean initialization. The attempt to fetch the resource from the ServiceBus won't be attempted until a method on the resulting proxy is invoked. If it fails to locate the resource, it will throw a ResourceLoaderException indicating the service could not be loaded.

This allows for referencing of a potentially remote service in the spring context during startup which won't get used until after startup. If the remote service gets used *during* startup, then it must be available from the GRL during startup or else the ResourceLoaderException will be thrown.

Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Constructor Details

    • LazyServiceFactoryBean

      public LazyServiceFactoryBean()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • detectProxyInterfaces

      protected Class<?>[] detectProxyInterfaces()
    • getObject

      public Object getObject() throws Exception
      Specified by:
      getObject in interface org.springframework.beans.factory.FactoryBean<Object>
      Throws:
      Exception
    • getObjectType

      public Class<?> getObjectType()
      Specified by:
      getObjectType in interface org.springframework.beans.factory.FactoryBean<Object>
    • setObjectType

      public void setObjectType(Class<?> objectType)
    • isSingleton

      public boolean isSingleton()
      Specified by:
      isSingleton in interface org.springframework.beans.factory.FactoryBean<Object>
    • getServiceNamespace

      public String getServiceNamespace()
    • setServiceNamespace

      public void setServiceNamespace(String serviceNamespace)
    • getServiceName

      public String getServiceName()
    • setServiceName

      public void setServiceName(String serviceName)
    • getApplicationId

      public String getApplicationId()
    • setApplicationId

      public void setApplicationId(String applicationId)
    • getProxyInterfaces

      public Class<?>[] getProxyInterfaces()
    • setProxyInterfaces

      public void setProxyInterfaces(Class<?>[] proxyInterfaces)