PropertySourcesPropertyResolver constructor

PropertySourcesPropertyResolver(
  1. PropertySources? propertySources
)

A concrete implementation of AbstractPropertyResolver that retrieves property values from a collection of PropertySources managed by a MutablePropertySources container.

This class supports resolving placeholders in property values and converting properties to specific types using a registered ConversionService.

Example usage:

final sources = MutablePropertySources();
sources.addPropertySource(MapPropertySource('config', {'app.name': 'JetLeaf'}));

final resolver = PropertySourcesPropertyResolver(sources);
print(resolver.getProperty('app.name')); // JetLeaf
print(resolver.getPropertyWithDefault('app.port', '8080')); // 8080

Placeholder resolution:

sources.addPropertySource(MapPropertySource('env', {
  'host': 'localhost',
  'url': 'http://${host}:8080'
}));

print(resolver.resolvePlaceholders('API: ${url}')); // API: http://localhost:8080

Implementation

PropertySourcesPropertyResolver(this.propertySources);