Class ResourceAdapterFactoryBean

java.lang.Object
org.springframework.jca.support.ResourceAdapterFactoryBean
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<jakarta.resource.spi.ResourceAdapter>, org.springframework.beans.factory.InitializingBean

public class ResourceAdapterFactoryBean extends Object implements org.springframework.beans.factory.FactoryBean<jakarta.resource.spi.ResourceAdapter>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
FactoryBean that bootstraps the specified JCA 1.7 ResourceAdapter, starting it with a local BootstrapContext and exposing it for bean references. It will also stop the ResourceAdapter on context shutdown. This corresponds to 'non-managed' bootstrap in a local environment, according to the JCA 1.7 specification.

This is essentially an adapter for bean-style bootstrapping of a JCA ResourceAdapter, allowing the BootstrapContext or its elements (such as the JCA WorkManager) to be specified through bean properties.

Since:
2.0.3
Author:
Juergen Hoeller
See Also:
  • Field Summary

    Fields inherited from interface org.springframework.beans.factory.FactoryBean

    OBJECT_TYPE_ATTRIBUTE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Builds the BootstrapContext and starts the ResourceAdapter with it.
    void
    Stops the ResourceAdapter.
    @Nullable jakarta.resource.spi.ResourceAdapter
     
    Class<? extends jakarta.resource.spi.ResourceAdapter>
     
    boolean
     
    void
    setBootstrapContext(jakarta.resource.spi.BootstrapContext bootstrapContext)
    Specify the JCA BootstrapContext to use for starting the ResourceAdapter.
    void
    setResourceAdapter(jakarta.resource.spi.ResourceAdapter resourceAdapter)
    Specify the target JCA ResourceAdapter, passed in as configured instance which hasn't been started yet.
    void
    setResourceAdapterClass(Class<? extends jakarta.resource.spi.ResourceAdapter> resourceAdapterClass)
    Specify the target JCA ResourceAdapter as class, to be instantiated with its default configuration.
    void
    setWorkManager(jakarta.resource.spi.work.WorkManager workManager)
    Specify the JCA WorkManager to use for bootstrapping the ResourceAdapter.
    void
    setXaTerminator(jakarta.resource.spi.XATerminator xaTerminator)
    Specify the JCA XATerminator to use for bootstrapping the ResourceAdapter.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ResourceAdapterFactoryBean

      public ResourceAdapterFactoryBean()
  • Method Details

    • setResourceAdapterClass

      public void setResourceAdapterClass(Class<? extends jakarta.resource.spi.ResourceAdapter> resourceAdapterClass)
      Specify the target JCA ResourceAdapter as class, to be instantiated with its default configuration.

      Alternatively, specify a pre-configured ResourceAdapter instance through the "resourceAdapter" property.

      See Also:
    • setResourceAdapter

      public void setResourceAdapter(jakarta.resource.spi.ResourceAdapter resourceAdapter)
      Specify the target JCA ResourceAdapter, passed in as configured instance which hasn't been started yet. This will typically happen as an inner bean definition, configuring the ResourceAdapter instance through its vendor-specific bean properties.
    • setBootstrapContext

      public void setBootstrapContext(jakarta.resource.spi.BootstrapContext bootstrapContext)
      Specify the JCA BootstrapContext to use for starting the ResourceAdapter.

      Alternatively, you can specify the individual parts (such as the JCA WorkManager) as individual references.

      See Also:
    • setWorkManager

      public void setWorkManager(jakarta.resource.spi.work.WorkManager workManager)
      Specify the JCA WorkManager to use for bootstrapping the ResourceAdapter.
      See Also:
    • setXaTerminator

      public void setXaTerminator(jakarta.resource.spi.XATerminator xaTerminator)
      Specify the JCA XATerminator to use for bootstrapping the ResourceAdapter.
      See Also:
    • afterPropertiesSet

      public void afterPropertiesSet() throws jakarta.resource.ResourceException
      Builds the BootstrapContext and starts the ResourceAdapter with it.
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      jakarta.resource.ResourceException
      See Also:
      • ResourceAdapter.start(jakarta.resource.spi.BootstrapContext)
    • getObject

      public @Nullable jakarta.resource.spi.ResourceAdapter getObject()
      Specified by:
      getObject in interface org.springframework.beans.factory.FactoryBean<jakarta.resource.spi.ResourceAdapter>
    • getObjectType

      public Class<? extends jakarta.resource.spi.ResourceAdapter> getObjectType()
      Specified by:
      getObjectType in interface org.springframework.beans.factory.FactoryBean<jakarta.resource.spi.ResourceAdapter>
    • isSingleton

      public boolean isSingleton()
      Specified by:
      isSingleton in interface org.springframework.beans.factory.FactoryBean<jakarta.resource.spi.ResourceAdapter>
    • destroy

      public void destroy()
      Stops the ResourceAdapter.
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      See Also:
      • ResourceAdapter.stop()