The parsing phase for a @Configuration
class involves reading its class definition, populating a collection of Configuration objects (because one @Configuration
class may @Import
another @Configuration
class so these imports are parsed as well), processing @PropertySources
, @ImportResources
etc.
Processing @PropertySources
doesn't, also, load those properties yet. After the parsing phase is done, the @PropertySources
properties are loaded. After these are loaded, then the beans' definitions from inside @Configuration
classes are registered (REGISTER_BEAN phase).
So, what you see using a ConfigurationCondition
with ConfigurationPhase.REGISTER_BEAN
phase is expected because those properties are actually available in the Environment
at the time when beans' definitions are registered and after the @Configuration
class has been parsed.
Using just a Condition
I believe it doesn't even reach the parsing phase of a @Configuration
, the evaluation is done even before that, when the @Configuration
class definition is to be registered.