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

org.zodiac.autoconfigure.social.condition.ConditionalOnSecuritySocialEnabled Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
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;
        }

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy