Search in sources :

Example 1 with PlaceholdersResolver

use of cn.taketoday.context.properties.bind.PlaceholdersResolver in project today-framework by TAKETODAY.

the class ConfigDataEnvironmentContributor method withBoundProperties.

/**
 * Create a new {@link ConfigDataEnvironmentContributor} with bound
 * {@link ConfigDataProperties}.
 *
 * @param contributors the contributors used for binding
 * @param activationContext the activation context
 * @return a new contributor instance
 */
ConfigDataEnvironmentContributor withBoundProperties(Iterable<ConfigDataEnvironmentContributor> contributors, @Nullable ConfigDataActivationContext activationContext) {
    Iterable<ConfigurationPropertySource> sources = Collections.singleton(getConfigurationPropertySource());
    PlaceholdersResolver placeholdersResolver = new ConfigDataEnvironmentContributorPlaceholdersResolver(contributors, activationContext, this, true);
    Binder binder = new Binder(sources, placeholdersResolver, null, null, null);
    ConfigDataProperties properties = ConfigDataProperties.get(binder);
    if (properties != null && this.configDataOptions.contains(ConfigData.Option.IGNORE_IMPORTS)) {
        properties = properties.withoutImports();
    }
    return new ConfigDataEnvironmentContributor(Kind.BOUND_IMPORT, this.location, this.resource, this.fromProfileSpecificImport, this.propertySource, this.configurationPropertySource, properties, this.configDataOptions, null);
}
Also used : Binder(cn.taketoday.context.properties.bind.Binder) PlaceholdersResolver(cn.taketoday.context.properties.bind.PlaceholdersResolver) ConfigurationPropertySource(cn.taketoday.context.properties.source.ConfigurationPropertySource)

Example 2 with PlaceholdersResolver

use of cn.taketoday.context.properties.bind.PlaceholdersResolver in project today-infrastructure by TAKETODAY.

the class ConfigDataEnvironmentContributor method withBoundProperties.

/**
 * Create a new {@link ConfigDataEnvironmentContributor} with bound
 * {@link ConfigDataProperties}.
 *
 * @param contributors the contributors used for binding
 * @param activationContext the activation context
 * @return a new contributor instance
 */
ConfigDataEnvironmentContributor withBoundProperties(Iterable<ConfigDataEnvironmentContributor> contributors, @Nullable ConfigDataActivationContext activationContext) {
    Iterable<ConfigurationPropertySource> sources = Collections.singleton(getConfigurationPropertySource());
    PlaceholdersResolver placeholdersResolver = new ConfigDataEnvironmentContributorPlaceholdersResolver(contributors, activationContext, this, true);
    Binder binder = new Binder(sources, placeholdersResolver, null, null, null);
    ConfigDataProperties properties = ConfigDataProperties.get(binder);
    if (properties != null && this.configDataOptions.contains(ConfigData.Option.IGNORE_IMPORTS)) {
        properties = properties.withoutImports();
    }
    return new ConfigDataEnvironmentContributor(Kind.BOUND_IMPORT, this.location, this.resource, this.fromProfileSpecificImport, this.propertySource, this.configurationPropertySource, properties, this.configDataOptions, null);
}
Also used : Binder(cn.taketoday.context.properties.bind.Binder) PlaceholdersResolver(cn.taketoday.context.properties.bind.PlaceholdersResolver) ConfigurationPropertySource(cn.taketoday.context.properties.source.ConfigurationPropertySource)

Aggregations

Binder (cn.taketoday.context.properties.bind.Binder)2 PlaceholdersResolver (cn.taketoday.context.properties.bind.PlaceholdersResolver)2 ConfigurationPropertySource (cn.taketoday.context.properties.source.ConfigurationPropertySource)2