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 Details

    • MicronautEnvironment

      public MicronautEnvironment(io.micronaut.context.env.Environment environment)
      Default constructor.
      Parameters:
      environment - The target environment
  • Method Details

    • getActiveProfiles

      public String[] getActiveProfiles()
      Specified by:
      getActiveProfiles in interface org.springframework.core.env.Environment
    • getDefaultProfiles

      public String[] getDefaultProfiles()
      Specified by:
      getDefaultProfiles in interface org.springframework.core.env.Environment
    • acceptsProfiles

      public boolean acceptsProfiles(@NonNull @NonNull String... profiles)
      Specified by:
      acceptsProfiles in interface org.springframework.core.env.Environment
    • acceptsProfiles

      public boolean acceptsProfiles(@NonNull @NonNull org.springframework.core.env.Profiles profiles)
      Specified by:
      acceptsProfiles in interface org.springframework.core.env.Environment
    • containsProperty

      public boolean containsProperty(String key)
      Specified by:
      containsProperty in interface org.springframework.core.env.PropertyResolver
    • getProperty

      @Nullable public @Nullable String getProperty(@NonNull @NonNull String key)
      Specified by:
      getProperty in interface org.springframework.core.env.PropertyResolver
    • getProperty

      @NonNull public @NonNull String getProperty(@NonNull @NonNull String key, @NonNull @NonNull String defaultValue)
      Specified by:
      getProperty in interface org.springframework.core.env.PropertyResolver
    • getProperty

      @Nullable public <T> T getProperty(@NonNull @NonNull String key, @NonNull @NonNull Class<T> targetType)
      Specified by:
      getProperty in interface org.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 interface org.springframework.core.env.PropertyResolver
    • getRequiredProperty

      public String getRequiredProperty(@NonNull @NonNull String key) throws IllegalStateException
      Specified by:
      getRequiredProperty in interface org.springframework.core.env.PropertyResolver
      Throws:
      IllegalStateException
    • getRequiredProperty

      public <T> T getRequiredProperty(String key, Class<T> targetType) throws IllegalStateException
      Specified by:
      getRequiredProperty in interface org.springframework.core.env.PropertyResolver
      Throws:
      IllegalStateException
    • resolvePlaceholders

      public String resolvePlaceholders(@NonNull @NonNull String text)
      Specified by:
      resolvePlaceholders in interface org.springframework.core.env.PropertyResolver
    • resolveRequiredPlaceholders

      public String resolveRequiredPlaceholders(@NonNull @NonNull String text) throws IllegalArgumentException
      Specified by:
      resolveRequiredPlaceholders in interface org.springframework.core.env.PropertyResolver
      Throws:
      IllegalArgumentException
    • getEnvironment

      @NonNull public io.micronaut.context.env.Environment getEnvironment()
      The target environment.
      Returns:
      The environment
    • setActiveProfiles

      public void setActiveProfiles(String... profiles)
      Specified by:
      setActiveProfiles in interface org.springframework.core.env.ConfigurableEnvironment
    • addActiveProfile

      public void addActiveProfile(String profile)
      Specified by:
      addActiveProfile in interface org.springframework.core.env.ConfigurableEnvironment
    • setDefaultProfiles

      public void setDefaultProfiles(String... profiles)
      Specified by:
      setDefaultProfiles in interface org.springframework.core.env.ConfigurableEnvironment
    • getPropertySources

      public org.springframework.core.env.MutablePropertySources getPropertySources()
      Specified by:
      getPropertySources in interface org.springframework.core.env.ConfigurableEnvironment
    • getSystemProperties

      public Map<String,Object> getSystemProperties()
      Specified by:
      getSystemProperties in interface org.springframework.core.env.ConfigurableEnvironment
    • getSystemEnvironment

      public Map<String,Object> getSystemEnvironment()
      Specified by:
      getSystemEnvironment in interface org.springframework.core.env.ConfigurableEnvironment
    • merge

      public void merge(org.springframework.core.env.ConfigurableEnvironment parent)
      Specified by:
      merge in interface org.springframework.core.env.ConfigurableEnvironment
    • getConversionService

      public org.springframework.core.convert.support.ConfigurableConversionService getConversionService()
      Specified by:
      getConversionService in interface org.springframework.core.env.ConfigurablePropertyResolver
    • setConversionService

      public void setConversionService(org.springframework.core.convert.support.ConfigurableConversionService conversionService)
      Specified by:
      setConversionService in interface org.springframework.core.env.ConfigurablePropertyResolver
    • setPlaceholderPrefix

      public void setPlaceholderPrefix(String placeholderPrefix)
      Specified by:
      setPlaceholderPrefix in interface org.springframework.core.env.ConfigurablePropertyResolver
    • setPlaceholderSuffix

      public void setPlaceholderSuffix(String placeholderSuffix)
      Specified by:
      setPlaceholderSuffix in interface org.springframework.core.env.ConfigurablePropertyResolver
    • setValueSeparator

      public void setValueSeparator(String valueSeparator)
      Specified by:
      setValueSeparator in interface org.springframework.core.env.ConfigurablePropertyResolver
    • setIgnoreUnresolvableNestedPlaceholders

      public void setIgnoreUnresolvableNestedPlaceholders(boolean ignoreUnresolvableNestedPlaceholders)
      Specified by:
      setIgnoreUnresolvableNestedPlaceholders in interface org.springframework.core.env.ConfigurablePropertyResolver
    • setRequiredProperties

      public void setRequiredProperties(String... requiredProperties)
      Specified by:
      setRequiredProperties in interface org.springframework.core.env.ConfigurablePropertyResolver
    • validateRequiredProperties

      public void validateRequiredProperties() throws org.springframework.core.env.MissingRequiredPropertiesException
      Specified by:
      validateRequiredProperties in interface org.springframework.core.env.ConfigurablePropertyResolver
      Throws:
      org.springframework.core.env.MissingRequiredPropertiesException