All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.autoconfigure.application.metadata.AppMetadataAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.application.metadata;

import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.core.Ordered;
import org.springframework.core.env.Environment;
import org.zodiac.autoconfigure.application.ApplicationInfoProperties;
import org.zodiac.core.application.AppContext;
import org.zodiac.core.application.AppInstanceOps;
import org.zodiac.core.application.metadata.ApplicationMetadataCustomizer;
import org.zodiac.core.application.metadata.DefaultApplicationMetadataContributor;
import org.zodiac.core.application.metadata.ApplicationEnvironmentMetadataCustomizer;

import java.util.stream.Collectors;

@SpringBootConfiguration
public class AppMetadataAutoConfiguration implements Ordered {

    public AppMetadataAutoConfiguration() {
        super();
    }

    @Bean
    @ConditionalOnMissingBean
    protected AppInstanceOps appInstanceOps(Environment environment, AppContext appContext) {
        return new AppInstanceOps(environment, appContext);
    }

    @Bean
    @ConditionalOnMissingBean
    protected ApplicationEnvironmentMetadataCustomizer applicationEnvironmentMetadataCustomizer(Environment environment) {
        return new ApplicationEnvironmentMetadataCustomizer(environment);
    }

    @Bean
    @ConditionalOnMissingBean
    protected DefaultApplicationMetadataContributor defaultApplicationMetadataContributor(
        ObjectProvider metadataCustomizers,
        ApplicationInfoProperties applicationExternalProperties, AppContext appContext) {
        return new DefaultApplicationMetadataContributor(applicationExternalProperties, appContext,
            metadataCustomizers.stream().collect(Collectors.toList()));
    }

    @Override
    public int getOrder() {
        return Ordered.HIGHEST_PRECEDENCE;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy