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.

Comment From: mihailcornescu

Hi. Can I take care of this one?

Comment From: wilkinsona

Yes please, @mihailcornescu. That'd be great. Please let us know if you have any questions.

Comment From: mihailcornescu

Yeah, sure.

Comment From: mihailcornescu

@wilkinsona I have raised PR #29276 . What do you think of it?

Comment From: mihailcornescu

It looks like there are some check failures. I will fix them and I will come back.

Comment From: philwebb

Closing in favor of PR #29276. Thanks @mihailcornescu!