I am guessing this behavior is because you have the second bean annotated with @ConditionalProperty, which checks if the bean with the specific name is registered, if it is not its created, if it is it does nothing, that is why spring is not failing. You can also check if you are on intelij your active beans under dubug and actuator to see your live bean. Only one should be active.