Referencing a bean in @ConditionalOnExpression will cause the bean to be initialized very early in context refresh processing. This can cause problems such as this one. We should add a warning about this to the annotation's javadoc and, perhaps, somewhere in the references docs as well.