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

org.zodiac.autoconfigure.application.shutdown.AppShutdownAutoConfiguration Maven / Gradle / Ivy

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

import java.util.stream.Collectors;

import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.zodiac.autoconfigure.application.condition.ConditionalOnApplicationShutdownEnabled;
import org.zodiac.commons.constants.SystemPropertiesConstants;
import org.zodiac.core.application.shutdown.AppShutdown;
import org.zodiac.core.application.shutdown.AppShutdownListener;

@SpringBootConfiguration
@ConditionalOnApplicationShutdownEnabled
public class AppShutdownAutoConfiguration {

    public AppShutdownAutoConfiguration() {
        super();
    }

    @Bean
    @ConditionalOnMissingBean
    @ConfigurationProperties(prefix = SystemPropertiesConstants.Zodiac.SPRING_SHUTDOWN_PREFIX, ignoreInvalidFields = true)
    protected AppShutdownConfigProperties appShutdownConfigProperties() {
        return new AppShutdownConfigProperties();
    }

    @Bean
    @ConditionalOnMissingBean
    protected AppShutdownListener appShutdownListener(ObjectProvider appShutdowns) {
        return new AppShutdownListener(appShutdowns.stream().collect(Collectors.toList()));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy