de.otto.edison.status.configuration.VersionInfoConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of edison-core Show documentation
Show all versions of edison-core Show documentation
Core library for all Edison libraries.
package de.otto.edison.status.configuration;
import de.otto.edison.status.domain.VersionInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.info.GitProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Configuration of the application's version.
*
* VersionInfo is used to give information about the current service's version on a status page.
*
*/
@Configuration
@EnableConfigurationProperties(VersionInfoProperties.class)
public class VersionInfoConfiguration {
@Autowired(required = false)
private GitProperties gitProperties = null;
@Bean
@ConditionalOnMissingBean(VersionInfo.class)
public VersionInfo gitInfo(final VersionInfoProperties versionInfoProperties) {
return VersionInfo.versionInfo(versionInfoProperties, gitProperties);
}
}