Package io.micronaut.spring.context.env
Class MicronautEnvironment
java.lang.Object
io.micronaut.spring.context.env.MicronautEnvironment
- All Implemented Interfaces:
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 Object
implements org.springframework.core.env.ConfigurableEnvironment, MicronautContextInternal
Implementation of the
Environment
interface for Micronaut.- Since:
- 1.0
- Author:
- graemerocher
-
Constructor Summary
ConstructorDescriptionMicronautEnvironment
(io.micronaut.context.env.Environment environment) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
acceptsProfiles
(@NonNull String... profiles) boolean
acceptsProfiles
(@NonNull org.springframework.core.env.Profiles profiles) void
addActiveProfile
(String profile) boolean
containsProperty
(String key) String[]
org.springframework.core.convert.support.ConfigurableConversionService
String[]
io.micronaut.context.env.Environment
The target environment.@Nullable String
getProperty
(@NonNull String key) <T> T
getProperty
(@NonNull String key, @NonNull Class<T> targetType) <T> T
getProperty
(@NonNull String key, @NonNull Class<T> targetType, T defaultValue) @NonNull String
getProperty
(@NonNull String key, @NonNull String defaultValue) org.springframework.core.env.MutablePropertySources
getRequiredProperty
(@NonNull String key) <T> T
getRequiredProperty
(String key, Class<T> targetType) void
merge
(org.springframework.core.env.ConfigurableEnvironment parent) resolvePlaceholders
(@NonNull String text) resolveRequiredPlaceholders
(@NonNull String text) void
setActiveProfiles
(String... profiles) void
setConversionService
(org.springframework.core.convert.support.ConfigurableConversionService conversionService) void
setDefaultProfiles
(String... profiles) void
setIgnoreUnresolvableNestedPlaceholders
(boolean ignoreUnresolvableNestedPlaceholders) void
setPlaceholderPrefix
(String placeholderPrefix) void
setPlaceholderSuffix
(String placeholderSuffix) void
setRequiredProperties
(String... requiredProperties) void
setValueSeparator
(String valueSeparator) void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.core.env.Environment
matchesProfiles
-
Constructor Details
-
MicronautEnvironment
public MicronautEnvironment(io.micronaut.context.env.Environment environment) Default constructor.- Parameters:
environment
- The target environment
-
-
Method Details
-
getActiveProfiles
- Specified by:
getActiveProfiles
in interfaceorg.springframework.core.env.Environment
-
getDefaultProfiles
- Specified by:
getDefaultProfiles
in interfaceorg.springframework.core.env.Environment
-
acceptsProfiles
- Specified by:
acceptsProfiles
in interfaceorg.springframework.core.env.Environment
-
acceptsProfiles
public boolean acceptsProfiles(@NonNull @NonNull org.springframework.core.env.Profiles profiles) - Specified by:
acceptsProfiles
in interfaceorg.springframework.core.env.Environment
-
containsProperty
- Specified by:
containsProperty
in interfaceorg.springframework.core.env.PropertyResolver
-
getProperty
- Specified by:
getProperty
in interfaceorg.springframework.core.env.PropertyResolver
-
getProperty
@NonNull public @NonNull String getProperty(@NonNull @NonNull String key, @NonNull @NonNull String defaultValue) - Specified by:
getProperty
in interfaceorg.springframework.core.env.PropertyResolver
-
getProperty
@Nullable public <T> T getProperty(@NonNull @NonNull String key, @NonNull @NonNull Class<T> targetType) - Specified by:
getProperty
in interfaceorg.springframework.core.env.PropertyResolver
-
getProperty
public <T> T getProperty(@NonNull @NonNull String key, @NonNull @NonNull Class<T> targetType, @NonNull T defaultValue) - Specified by:
getProperty
in interfaceorg.springframework.core.env.PropertyResolver
-
getRequiredProperty
- Specified by:
getRequiredProperty
in interfaceorg.springframework.core.env.PropertyResolver
- Throws:
IllegalStateException
-
getRequiredProperty
- Specified by:
getRequiredProperty
in interfaceorg.springframework.core.env.PropertyResolver
- Throws:
IllegalStateException
-
resolvePlaceholders
- Specified by:
resolvePlaceholders
in interfaceorg.springframework.core.env.PropertyResolver
-
resolveRequiredPlaceholders
public String resolveRequiredPlaceholders(@NonNull @NonNull String text) throws IllegalArgumentException - Specified by:
resolveRequiredPlaceholders
in interfaceorg.springframework.core.env.PropertyResolver
- Throws:
IllegalArgumentException
-
getEnvironment
@NonNull public io.micronaut.context.env.Environment getEnvironment()The target environment.- Returns:
- The environment
-
setActiveProfiles
- Specified by:
setActiveProfiles
in interfaceorg.springframework.core.env.ConfigurableEnvironment
-
addActiveProfile
- Specified by:
addActiveProfile
in interfaceorg.springframework.core.env.ConfigurableEnvironment
-
setDefaultProfiles
- 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
- Specified by:
getSystemProperties
in interfaceorg.springframework.core.env.ConfigurableEnvironment
-
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
- Specified by:
setPlaceholderPrefix
in interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
setPlaceholderSuffix
- Specified by:
setPlaceholderSuffix
in interfaceorg.springframework.core.env.ConfigurablePropertyResolver
-
setValueSeparator
- 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
- 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
-