org.zodiac.autoconfigure.bootstrap.registry.AutoAppRegistrationAutoConfiguration Maven / Gradle / Ivy
package org.zodiac.autoconfigure.bootstrap.registry;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Import;
import org.zodiac.commons.constants.SystemPropertiesConstants;
import org.zodiac.core.bootstrap.registry.AutoAppRegistration;
@SpringBootConfiguration
@Import(value = {AutoAppRegistrationConfiguration.class})
@ConditionalOnProperty(value = SystemPropertiesConstants.Zodiac.SPRING_BOOTSTRAP_REGISTRY_AUTO_REGIS_ENABLED,
matchIfMissing = true)
public class AutoAppRegistrationAutoConfiguration {
@Autowired(required = false)
private AutoAppRegistration autoAppRegistration;
@Autowired
private AutoAppRegistrationProperties properties;
@PostConstruct
protected void init() {
if (this.autoAppRegistration == null && this.properties.isFailFast()) {
throw new IllegalStateException(
String.format("Auto Application Registration has been requested, but there is no %s bean",
AutoAppRegistration.class.getSimpleName()));
}
}
}