com.ulisesbocchio.jasyptspringboot.environment.MutableConfigurablePropertyResolver Maven / Gradle / Ivy
The newest version!
package com.ulisesbocchio.jasyptspringboot.environment;
import lombok.experimental.Delegate;
import org.springframework.core.env.ConfigurablePropertyResolver;
import org.springframework.core.env.MutablePropertySources;
import java.util.function.Function;
/**
* MutableConfigurablePropertyResolver class.
*
* @author boccs002
* @version $Id: $Id
*/
public class MutableConfigurablePropertyResolver implements ConfigurablePropertyResolver {
private final Function factory;
@Delegate
private ConfigurablePropertyResolver delegate;
/**
* Constructor for MutableConfigurablePropertyResolver.
*
* @param propertySources a {@link org.springframework.core.env.MutablePropertySources} object
* @param factory a {@link java.util.function.Function} object
*/
public MutableConfigurablePropertyResolver(MutablePropertySources propertySources, Function factory) {
this.factory = factory;
this.delegate = factory.apply(propertySources);
}
/**
* setPropertySources.
*
* @param propertySources a {@link org.springframework.core.env.MutablePropertySources} object
*/
public void setPropertySources(MutablePropertySources propertySources) {
this.delegate = this.factory.apply(propertySources);
}
}