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.MicronautContextInternal
Implementation of theEnvironment
interface 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 boolean
acceptsProfiles(java.lang.String... profiles)
boolean
acceptsProfiles(org.springframework.core.env.Profiles profiles)
void
addActiveProfile(java.lang.String profile)
boolean
containsProperty(java.lang.String key)
java.lang.String[]
getActiveProfiles()
org.springframework.core.convert.support.ConfigurableConversionService
getConversionService()
java.lang.String[]
getDefaultProfiles()
io.micronaut.context.env.Environment
getEnvironment()
The target environment.java.lang.String
getProperty(java.lang.String key)
<T> T
getProperty(java.lang.String key, java.lang.Class<T> targetType)
<T> T
getProperty(java.lang.String key, java.lang.Class<T> targetType, T defaultValue)
java.lang.String
getProperty(java.lang.String key, java.lang.String defaultValue)
org.springframework.core.env.MutablePropertySources
getPropertySources()
java.lang.String
getRequiredProperty(java.lang.String key)
<T> T
getRequiredProperty(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()
void
merge(org.springframework.core.env.ConfigurableEnvironment parent)
java.lang.String
resolvePlaceholders(java.lang.String text)
java.lang.String
resolveRequiredPlaceholders(java.lang.String text)
void
setActiveProfiles(java.lang.String... profiles)
void
setConversionService(org.springframework.core.convert.support.ConfigurableConversionService conversionService)
void
setDefaultProfiles(java.lang.String... profiles)
void
setIgnoreUnresolvableNestedPlaceholders(boolean ignoreUnresolvableNestedPlaceholders)
void
setPlaceholderPrefix(java.lang.String placeholderPrefix)
void
setPlaceholderSuffix(java.lang.String placeholderSuffix)
void
setRequiredProperties(java.lang.String... requiredProperties)
void
setValueSeparator(java.lang.String valueSeparator)
void
validateRequiredProperties()
-
-
-
Method Detail
-
getActiveProfiles
public java.lang.String[] getActiveProfiles()
- Specified by:
getActiveProfiles
in interfaceorg.springframework.core.env.Environment
-
getDefaultProfiles
public java.lang.String[] getDefaultProfiles()
- Specified by:
getDefaultProfiles
in interfaceorg.springframework.core.env.Environment
-
acceptsProfiles
public boolean acceptsProfiles(@NonNull java.lang.String... profiles)
- Specified by:
acceptsProfiles
in interfaceorg.springframework.core.env.Environment
-
acceptsProfiles
public boolean acceptsProfiles(@NonNull org.springframework.core.env.Profiles profiles)
- Specified by:
acceptsProfiles
in interfaceorg.springframework.core.env.Environment
-
containsProperty
public boolean containsProperty(java.lang.String key)
- Specified by:
containsProperty
in interfaceorg.springframework.core.env.PropertyResolver
-
getProperty
@Nullable public java.lang.String getProperty(@NonNull java.lang.String key)
- Specified by:
getProperty
in interfaceorg.springframework.core.env.PropertyResolver
-
getProperty
@NonNull public java.lang.String getProperty(@NonNull java.lang.String key, @NonNull java.lang.String defaultValue)
- Specified by:
getProperty
in interfaceorg.springframework.core.env.PropertyResolver
-
getProperty
@Nullable public <T> T getProperty(@NonNull java.lang.String key, @NonNull java.lang.Class<T> targetType)
- Specified by:
getProperty
in 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:
getProperty
in interfaceorg.springframework.core.env.PropertyResolver
-
getRequiredProperty
public java.lang.String getRequiredProperty(@NonNull java.lang.String key) throws java.lang.IllegalStateException
- Specified by:
getRequiredProperty
in 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:
getRequiredProperty
in interfaceorg.springframework.core.env.PropertyResolver
- Throws:
java.lang.IllegalStateException
-
resolvePlaceholders
public java.lang.String resolvePlaceholders(@NonNull java.lang.String text)
- Specified by:
resolvePlaceholders
in interfaceorg.springframework.core.env.PropertyResolver
-
resolveRequiredPlaceholders
public java.lang.String resolveRequiredPlaceholders(@NonNull java.lang.String text) throws java.lang.IllegalArgumentException
- Specified by:
resolveRequiredPlaceholders
in 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:
setActiveProfiles
in interfaceorg.springframework.core.env.ConfigurableEnvironment
-
addActiveProfile
public void addActiveProfile(java.lang.String profile)
- Specified by:
addActiveProfile
in interfaceorg.springframework.core.env.ConfigurableEnvironment
-
setDefaultProfiles
public void setDefaultProfiles(java.lang.String... profiles)
- Specified by:
setDefaultProfiles
in interfaceorg.springframework.core.env.ConfigurableEnvironment
-
getPropertySources
public org.springframework.core.env.MutablePropertySources getPropertySources()
- Specified by:
getPropertySources
in interfaceorg.springframework.core.env.ConfigurableEnvironment
-
getSystemProperties
public java.util.Map<java.lang.String,java.lang.Object> getSystemProperties()
- Specified by:
getSystemProperties
in interfaceorg.springframework.core.env.ConfigurableEnvironment
-
getSystemEnvironment
public java.util.Map<java.lang.String,java.lang.Object> getSystemEnvironment()
- Specified by:
getSystemEnvironment
in interfaceorg.springframework.core.env.ConfigurableEnvironment
-
merge
public void merge(org.springframework.core.env.ConfigurableEnvironment parent)
- Specified by:
merge
in interfaceorg.springframework.core.env.ConfigurableEnvironment
-
getConversionService
public org.springframework.core.convert.support.ConfigurableConversionService getConversionService()
- Specified by:
getConversionService
in interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
setConversionService
public void setConversionService(org.springframework.core.convert.support.ConfigurableConversionService conversionService)
- Specified by:
setConversionService
in interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
setPlaceholderPrefix
public void setPlaceholderPrefix(java.lang.String placeholderPrefix)
- Specified by:
setPlaceholderPrefix
in interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
setPlaceholderSuffix
public void setPlaceholderSuffix(java.lang.String placeholderSuffix)
- Specified by:
setPlaceholderSuffix
in interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
setValueSeparator
public void setValueSeparator(java.lang.String valueSeparator)
- Specified by:
setValueSeparator
in interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
setIgnoreUnresolvableNestedPlaceholders
public void setIgnoreUnresolvableNestedPlaceholders(boolean ignoreUnresolvableNestedPlaceholders)
- Specified by:
setIgnoreUnresolvableNestedPlaceholders
in interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
setRequiredProperties
public void setRequiredProperties(java.lang.String... requiredProperties)
- Specified by:
setRequiredProperties
in interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
validateRequiredProperties
public void validateRequiredProperties() throws org.springframework.core.env.MissingRequiredPropertiesException
- Specified by:
validateRequiredProperties
in interfaceorg.springframework.core.env.ConfigurablePropertyResolver
- Throws:
org.springframework.core.env.MissingRequiredPropertiesException
-
-