You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A configuration class superclass that is skipped due to register bean phase conditions is ignored when another configuration class that extends it is processed
#28676
Closed
wilkinsona opened this issue
Jun 22, 2022
· 0 comments
Affects: 6.0.x. I expect 5.3.x to also be affected.
I think @mbhave and I have found a bug in configuration class processing related to condition evaluation. It's hopefully illustrated by the following tests:
superclassSkippedInParseConfigurationPhaseShouldNotPreventSubsequentProcessingOfSameSuperclass passes but superclassSkippedInRegisterBeanPhaseShouldNotPreventSubsequentProcessingOfSameSuperclass fails.
The register bean phase test fails due to the knownSuperclasses map in ConfigurationClassParser being polluted. Due to the parse configuration phase conditions matching an entry is added to the map for Example -> RegisterBeanPhaseExample. Subsequently, the register bean phase condition on RegisterBeanPhaseExample does not match, so neither it nor Example are processed. When BravoExample is then parsed, ConfigurationClassParser considers its superclass Example. It's skipped due to the existing entry in the knownSuperclasses map, despite the fact that Example was never actually processed due to the conditions on RegisterBeanPhaseExample. The end result is that the context is left without a bean named superclassBean.
The text was updated successfully, but these errors were encountered:
Affects: 6.0.x. I expect 5.3.x to also be affected.
I think @mbhave and I have found a bug in configuration class processing related to condition evaluation. It's hopefully illustrated by the following tests:
superclassSkippedInParseConfigurationPhaseShouldNotPreventSubsequentProcessingOfSameSuperclass
passes butsuperclassSkippedInRegisterBeanPhaseShouldNotPreventSubsequentProcessingOfSameSuperclass
fails.The register bean phase test fails due to the
knownSuperclasses
map inConfigurationClassParser
being polluted. Due to the parse configuration phase conditions matching an entry is added to the map forExample -> RegisterBeanPhaseExample
. Subsequently, the register bean phase condition onRegisterBeanPhaseExample
does not match, so neither it norExample
are processed. WhenBravoExample
is then parsed,ConfigurationClassParser
considers its superclassExample
. It's skipped due to the existing entry in theknownSuperclasses
map, despite the fact thatExample
was never actually processed due to the conditions onRegisterBeanPhaseExample
. The end result is that the context is left without a bean namedsuperclassBean
.The text was updated successfully, but these errors were encountered: