Package io.micronaut.spring.context.env
Class MicronautEnvironment
- java.lang.Object
-
- io.micronaut.spring.context.env.MicronautEnvironment
-
- All Implemented Interfaces:
io.micronaut.spring.beans.MicronautContextInternal,org.springframework.core.env.ConfigurableEnvironment,org.springframework.core.env.ConfigurablePropertyResolver,org.springframework.core.env.Environment,org.springframework.core.env.PropertyResolver
@Singleton @Primary @Internal public class MicronautEnvironment extends java.lang.Object implements org.springframework.core.env.ConfigurableEnvironment, io.micronaut.spring.beans.MicronautContextInternalImplementation of theEnvironmentinterface for Micronaut.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description MicronautEnvironment(io.micronaut.context.env.Environment environment)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptsProfiles(java.lang.String... profiles)booleanacceptsProfiles(org.springframework.core.env.Profiles profiles)voidaddActiveProfile(java.lang.String profile)booleancontainsProperty(java.lang.String key)java.lang.String[]getActiveProfiles()org.springframework.core.convert.support.ConfigurableConversionServicegetConversionService()java.lang.String[]getDefaultProfiles()io.micronaut.context.env.EnvironmentgetEnvironment()The target environment.java.lang.StringgetProperty(java.lang.String key)<T> TgetProperty(java.lang.String key, java.lang.Class<T> targetType)<T> TgetProperty(java.lang.String key, java.lang.Class<T> targetType, T defaultValue)java.lang.StringgetProperty(java.lang.String key, java.lang.String defaultValue)org.springframework.core.env.MutablePropertySourcesgetPropertySources()java.lang.StringgetRequiredProperty(java.lang.String key)<T> TgetRequiredProperty(java.lang.String key, java.lang.Class<T> targetType)java.util.Map<java.lang.String,java.lang.Object>getSystemEnvironment()java.util.Map<java.lang.String,java.lang.Object>getSystemProperties()voidmerge(org.springframework.core.env.ConfigurableEnvironment parent)java.lang.StringresolvePlaceholders(java.lang.String text)java.lang.StringresolveRequiredPlaceholders(java.lang.String text)voidsetActiveProfiles(java.lang.String... profiles)voidsetConversionService(org.springframework.core.convert.support.ConfigurableConversionService conversionService)voidsetDefaultProfiles(java.lang.String... profiles)voidsetIgnoreUnresolvableNestedPlaceholders(boolean ignoreUnresolvableNestedPlaceholders)voidsetPlaceholderPrefix(java.lang.String placeholderPrefix)voidsetPlaceholderSuffix(java.lang.String placeholderSuffix)voidsetRequiredProperties(java.lang.String... requiredProperties)voidsetValueSeparator(java.lang.String valueSeparator)voidvalidateRequiredProperties()
-
-
-
Method Detail
-
getActiveProfiles
public java.lang.String[] getActiveProfiles()
- Specified by:
getActiveProfilesin interfaceorg.springframework.core.env.Environment
-
getDefaultProfiles
public java.lang.String[] getDefaultProfiles()
- Specified by:
getDefaultProfilesin interfaceorg.springframework.core.env.Environment
-
acceptsProfiles
public boolean acceptsProfiles(@NonNull java.lang.String... profiles)- Specified by:
acceptsProfilesin interfaceorg.springframework.core.env.Environment
-
acceptsProfiles
public boolean acceptsProfiles(@NonNull org.springframework.core.env.Profiles profiles)- Specified by:
acceptsProfilesin interfaceorg.springframework.core.env.Environment
-
containsProperty
public boolean containsProperty(java.lang.String key)
- Specified by:
containsPropertyin interfaceorg.springframework.core.env.PropertyResolver
-
getProperty
@Nullable public java.lang.String getProperty(@NonNull java.lang.String key)- Specified by:
getPropertyin interfaceorg.springframework.core.env.PropertyResolver
-
getProperty
@NonNull public java.lang.String getProperty(@NonNull java.lang.String key, @NonNull java.lang.String defaultValue)- Specified by:
getPropertyin interfaceorg.springframework.core.env.PropertyResolver
-
getProperty
@Nullable public <T> T getProperty(@NonNull java.lang.String key, @NonNull java.lang.Class<T> targetType)- Specified by:
getPropertyin interfaceorg.springframework.core.env.PropertyResolver
-
getProperty
public <T> T getProperty(@NonNull java.lang.String key, @NonNull java.lang.Class<T> targetType, @NonNull T defaultValue)- Specified by:
getPropertyin interfaceorg.springframework.core.env.PropertyResolver
-
getRequiredProperty
public java.lang.String getRequiredProperty(@NonNull java.lang.String key) throws java.lang.IllegalStateException- Specified by:
getRequiredPropertyin interfaceorg.springframework.core.env.PropertyResolver- Throws:
java.lang.IllegalStateException
-
getRequiredProperty
public <T> T getRequiredProperty(java.lang.String key, java.lang.Class<T> targetType) throws java.lang.IllegalStateException- Specified by:
getRequiredPropertyin interfaceorg.springframework.core.env.PropertyResolver- Throws:
java.lang.IllegalStateException
-
resolvePlaceholders
public java.lang.String resolvePlaceholders(@NonNull java.lang.String text)- Specified by:
resolvePlaceholdersin interfaceorg.springframework.core.env.PropertyResolver
-
resolveRequiredPlaceholders
public java.lang.String resolveRequiredPlaceholders(@NonNull java.lang.String text) throws java.lang.IllegalArgumentException- Specified by:
resolveRequiredPlaceholdersin interfaceorg.springframework.core.env.PropertyResolver- Throws:
java.lang.IllegalArgumentException
-
getEnvironment
@NonNull public io.micronaut.context.env.Environment getEnvironment()
The target environment.- Returns:
- The environment
-
setActiveProfiles
public void setActiveProfiles(java.lang.String... profiles)
- Specified by:
setActiveProfilesin interfaceorg.springframework.core.env.ConfigurableEnvironment
-
addActiveProfile
public void addActiveProfile(java.lang.String profile)
- Specified by:
addActiveProfilein interfaceorg.springframework.core.env.ConfigurableEnvironment
-
setDefaultProfiles
public void setDefaultProfiles(java.lang.String... profiles)
- Specified by:
setDefaultProfilesin interfaceorg.springframework.core.env.ConfigurableEnvironment
-
getPropertySources
public org.springframework.core.env.MutablePropertySources getPropertySources()
- Specified by:
getPropertySourcesin interfaceorg.springframework.core.env.ConfigurableEnvironment
-
getSystemProperties
public java.util.Map<java.lang.String,java.lang.Object> getSystemProperties()
- Specified by:
getSystemPropertiesin interfaceorg.springframework.core.env.ConfigurableEnvironment
-
getSystemEnvironment
public java.util.Map<java.lang.String,java.lang.Object> getSystemEnvironment()
- Specified by:
getSystemEnvironmentin interfaceorg.springframework.core.env.ConfigurableEnvironment
-
merge
public void merge(org.springframework.core.env.ConfigurableEnvironment parent)
- Specified by:
mergein interfaceorg.springframework.core.env.ConfigurableEnvironment
-
getConversionService
public org.springframework.core.convert.support.ConfigurableConversionService getConversionService()
- Specified by:
getConversionServicein interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
setConversionService
public void setConversionService(org.springframework.core.convert.support.ConfigurableConversionService conversionService)
- Specified by:
setConversionServicein interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
setPlaceholderPrefix
public void setPlaceholderPrefix(java.lang.String placeholderPrefix)
- Specified by:
setPlaceholderPrefixin interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
setPlaceholderSuffix
public void setPlaceholderSuffix(java.lang.String placeholderSuffix)
- Specified by:
setPlaceholderSuffixin interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
setValueSeparator
public void setValueSeparator(java.lang.String valueSeparator)
- Specified by:
setValueSeparatorin interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
setIgnoreUnresolvableNestedPlaceholders
public void setIgnoreUnresolvableNestedPlaceholders(boolean ignoreUnresolvableNestedPlaceholders)
- Specified by:
setIgnoreUnresolvableNestedPlaceholdersin interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
setRequiredProperties
public void setRequiredProperties(java.lang.String... requiredProperties)
- Specified by:
setRequiredPropertiesin interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
validateRequiredProperties
public void validateRequiredProperties() throws org.springframework.core.env.MissingRequiredPropertiesException- Specified by:
validateRequiredPropertiesin interfaceorg.springframework.core.env.ConfigurablePropertyResolver- Throws:
org.springframework.core.env.MissingRequiredPropertiesException
-
-