org.zodiac.autoconfigure.social.condition.ConditionalOnSecuritySocialEnabled Maven / Gradle / Ivy
package org.zodiac.autoconfigure.social.condition;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
import org.springframework.core.type.AnnotatedTypeMetadata;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
@Conditional(ConditionalOnSecuritySocialEnabled.OnSecuritySocialEnabledCondition.class)
public @interface ConditionalOnSecuritySocialEnabled {
class OnSecuritySocialEnabledCondition implements Condition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
/*Obtain environment enable property value.*/
Boolean enabled = context.getEnvironment().getProperty(
org.zodiac.social.constants.SocialSystemPropertiesConstants.SPRING_SECURITY_SOCIAL_ENABLED, Boolean.class, Boolean.FALSE);
return enabled;
}
}
}