Class DefaultDiscriminatedPropertyAccessor
java.lang.Object
com.broadleafcommerce.common.extension.environment.DefaultDiscriminatedPropertyAccessor
- All Implemented Interfaces:
DiscriminatedPropertyAccessor,EventListener,org.springframework.context.ApplicationListener<org.springframework.cloud.context.environment.EnvironmentChangeEvent>
public class DefaultDiscriminatedPropertyAccessor
extends Object
implements DiscriminatedPropertyAccessor, org.springframework.context.ApplicationListener<org.springframework.cloud.context.environment.EnvironmentChangeEvent>
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultDiscriminatedPropertyAccessor(org.springframework.core.env.Environment environment) -
Method Summary
Modifier and TypeMethodDescription<T> TgetProperty(String key, Class<?> type, Supplier<Object> defaultValue) Fetch a marshalled configuration property instance from the Spring environmentvoidinit()voidonApplicationEvent(org.springframework.cloud.context.environment.EnvironmentChangeEvent event) Invalidate the cache for any property that have changed in the environment
-
Constructor Details
-
DefaultDiscriminatedPropertyAccessor
public DefaultDiscriminatedPropertyAccessor(org.springframework.core.env.Environment environment)
-
-
Method Details
-
init
@PostConstruct public void init() -
onApplicationEvent
public void onApplicationEvent(org.springframework.cloud.context.environment.EnvironmentChangeEvent event) Invalidate the cache for any property that have changed in the environment- Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.cloud.context.environment.EnvironmentChangeEvent>- Parameters:
event- the event to respond to
-
getProperty
Description copied from interface:DiscriminatedPropertyAccessorFetch a marshalled configuration property instance from the Spring environment- Specified by:
getPropertyin interfaceDiscriminatedPropertyAccessor- Type Parameters:
T- The type of the marshalled property value- Parameters:
key- The basic key to use to check the environment.type- The type to marshall the environment value todefaultValue- Supplier for the default value taken from theConfigurationPropertiesbean instance variable- Returns:
- The marshalled property value
-