Package org.opensaml.core.config.provider

# Class ThreadLocalConfigurationPropertiesSource

java.lang.Object
org.opensaml.core.config.provider.ThreadLocalConfigurationPropertiesSource

All Implemented Interfaces:
  `ConfigurationPropertiesSource`

public class ThreadLocalConfigurationPropertiesSource extends Object implements ConfigurationPropertiesSource
A configuration properties source implementation which obtains the properties set from a `ThreadLocal` variable.

This supports use cases where applications with different configuration needs are sharing a classloader, making usage of `ClasspathConfigurationPropertiesSource` inappropriate.

The thread-local properties instance is retrieved from `ThreadLocalConfigurationPropertiesHolder`. An application-specific means must be used to populate this appropriately for each thread, taking care to also clear it at the appropriate time (e.g. before the thread will be returned to a thread-pool and re-used).

For example, in a web application environment which uses Spring dependency injection, a servlet filter would be used to obtain the Properties bean from the Spring web application context (via the servlet context), and then populate the ThreadLocal via `ThreadLocalConfigurationPropertiesHolder.setProperties(Properties)`, making sure to then also clear it in a `finally` block after the filter chain has run via `ThreadLocalConfigurationPropertiesHolder.clear()`.

## Constructor Summary

Constructors
Constructor
Description
`ThreadLocalConfigurationPropertiesSource()`

## Method Summary

Modifier and Type
Method
Description
`ConfigurationProperties`
`getProperties()`
Get the property set exposed by the source.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ThreadLocalConfigurationPropertiesSource

public ThreadLocalConfigurationPropertiesSource()

## Method Details

### getProperties

@Nullable public ConfigurationProperties getProperties()
Get the property set exposed by the source.

Specified by:
  `getProperties` in interface `ConfigurationPropertiesSource`
Returns:
  the properties set or null