Я попробовал этот подход
Код: Выделить всё
@Conditional(SecurityEnabledCondition.class)
@Bean ...
public class SecurityEnabledCondition implements Condition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
ClientProperties clientProperties = context.getBeanFactory().getBean(ClientProperties.class);
return clientProperties.isSecured();
}
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... -in-spring
Мобильная версия