Close

Spring Framework - Condition Examples

Spring Framework 

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

import java.util.Locale;

public class LocaleConditionUSA implements Condition {

@Override
public boolean matches (ConditionContext context, AnnotatedTypeMetadata metadata) {
return Locale.getDefault()
.equals(Locale.US);
}
}
Original Post




import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

import java.util.Locale;

public class LocaleConditionCanada implements Condition {

@Override
public boolean matches (ConditionContext context, AnnotatedTypeMetadata metadata) {
return Locale.getDefault()
.equals(Locale.CANADA);
}
}
Original Post




See Also