Class 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 the Environment interface for Micronaut.
    Since:
    1.0
    • Constructor Detail

      • MicronautEnvironment

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

      • getActiveProfiles

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

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

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

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

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

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

        public java.lang.String getRequiredProperty​(@NonNull
                                                    java.lang.String key)
                                             throws java.lang.IllegalStateException
        Specified by:
        getRequiredProperty in interface org.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 interface org.springframework.core.env.PropertyResolver
        Throws:
        java.lang.IllegalStateException
      • resolvePlaceholders

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

        public java.lang.String resolveRequiredPlaceholders​(@NonNull
                                                            java.lang.String text)
                                                     throws java.lang.IllegalArgumentException
        Specified by:
        resolveRequiredPlaceholders in interface org.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 interface org.springframework.core.env.ConfigurableEnvironment
      • addActiveProfile

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

        public void setDefaultProfiles​(java.lang.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 java.util.Map<java.lang.String,​java.lang.Object> getSystemProperties()
        Specified by:
        getSystemProperties in interface org.springframework.core.env.ConfigurableEnvironment
      • getSystemEnvironment

        public java.util.Map<java.lang.String,​java.lang.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​(java.lang.String placeholderPrefix)
        Specified by:
        setPlaceholderPrefix in interface org.springframework.core.env.ConfigurablePropertyResolver
      • setPlaceholderSuffix

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

        public void setValueSeparator​(java.lang.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​(java.lang.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