Package org.springframework.jca.support

# Class ResourceAdapterFactoryBean

java.lang.Object
org.springframework.jca.support.ResourceAdapterFactoryBean

All Implemented Interfaces:
  `org.springframework.beans.factory.DisposableBean`, `org.springframework.beans.factory.FactoryBean<ResourceAdapter>`, `org.springframework.beans.factory.InitializingBean`

public class ResourceAdapterFactoryBean extends Object implements org.springframework.beans.factory.FactoryBean<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:
  - `setResourceAdapter(jakarta.resource.spi.ResourceAdapter)`
  - `setBootstrapContext(jakarta.resource.spi.BootstrapContext)`
  - `setWorkManager(jakarta.resource.spi.work.WorkManager)`
  - `ResourceAdapter.start(jakarta.resource.spi.BootstrapContext)`
  - `ResourceAdapter.stop()`

## Field Summary

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

`OBJECT_TYPE_ATTRIBUTE`

## Constructor Summary

Constructors
Constructor
Description
`ResourceAdapterFactoryBean()`

## Method Summary

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

### Methods inherited from class java.lang.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 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(jakarta.resource.spi.ResourceAdapter)`

### setResourceAdapter

public void setResourceAdapter(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(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(jakarta.resource.spi.work.WorkManager)`
  - `setXaTerminator(jakarta.resource.spi.XATerminator)`

### setWorkManager

public void setWorkManager(WorkManager workManager)
Specify the JCA WorkManager to use for bootstrapping the ResourceAdapter.

See Also:
  - `setBootstrapContext(jakarta.resource.spi.BootstrapContext)`

### setXaTerminator

public void setXaTerminator(XATerminator xaTerminator)
Specify the JCA XATerminator to use for bootstrapping the ResourceAdapter.

See Also:
  - `setBootstrapContext(jakarta.resource.spi.BootstrapContext)`

### afterPropertiesSet

public void afterPropertiesSet() throws ResourceException
Builds the BootstrapContext and starts the ResourceAdapter with it.

Specified by:
  `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`
Throws:
  `ResourceException`
See Also:
  - `ResourceAdapter.start(jakarta.resource.spi.BootstrapContext)`

### getObject

@Nullable public ResourceAdapter getObject()

Specified by:
  `getObject` in interface `org.springframework.beans.factory.FactoryBean<ResourceAdapter>`

### getObjectType

public Class<? extends ResourceAdapter> getObjectType()

Specified by:
  `getObjectType` in interface `org.springframework.beans.factory.FactoryBean<ResourceAdapter>`

### isSingleton

public boolean isSingleton()

Specified by:
  `isSingleton` in interface `org.springframework.beans.factory.FactoryBean<ResourceAdapter>`

### destroy

public void destroy()
Stops the ResourceAdapter.

Specified by:
  `destroy` in interface `org.springframework.beans.factory.DisposableBean`
See Also:
  - `ResourceAdapter.stop()`