Package org.springframework.core.io.support

# Class DefaultPropertySourceFactory

java.lang.Object
org.springframework.core.io.support.DefaultPropertySourceFactory

All Implemented Interfaces:
  `PropertySourceFactory`

public class DefaultPropertySourceFactory extends Object implements PropertySourceFactory
The default implementation for `PropertySourceFactory`, wrapping every resource in a `ResourcePropertySource`.

Since:
  4.3
Author:
  Juergen Hoeller
See Also:
  - `PropertySourceFactory`
  - `ResourcePropertySource`

## Constructor Summary

Constructors
Constructor
Description
`DefaultPropertySourceFactory()`

## Method Summary

Modifier and Type
Method
Description
`PropertySource<?>`
`createPropertySource(String name, EncodedResource resource)`
Create a `PropertySource` that wraps the given resource.

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

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

## Constructor Details

### DefaultPropertySourceFactory

public DefaultPropertySourceFactory()

## Method Details

### createPropertySource

public PropertySource<?> createPropertySource(@Nullable String name, EncodedResource resource) throws IOException
Description copied from interface: `PropertySourceFactory`
Create a `PropertySource` that wraps the given resource.

Implementations will typically create `ResourcePropertySource` instances, with `PropertySourceProcessor` automatically adapting property source names via `ResourcePropertySource.withResourceName()` if necessary, for example, when combining multiple sources for the same name into a `CompositePropertySource`. Custom implementations with custom `PropertySource` types need to make sure to expose distinct enough names, possibly deriving from `ResourcePropertySource` where possible.

Specified by:
  `createPropertySource` in interface `PropertySourceFactory`
Parameters:
  `name` - the name of the property source (can be `null` in which case the factory implementation will have to generate a name based on the given resource)
  `resource` - the resource (potentially encoded) to wrap
Returns:
  the new `PropertySource` (never `null`)
Throws:
  `IOException` - if resource resolution failed