BeanOverrideTestExecutionListener
currently "nulls out" bean override fields before re-injecting values. Similarly, BeanOverrideRegistrar
has an optimization to forgo injection if the field value would not change, and it throws an exception if the field has not been "nulled out" or if the field is assigned an unexpected value.
However, there is not much benefit in the added overhead of the current logic. Furthermore, this behavior is contrast to the behavior for field injection within the core container and within the Spring TestContext Framework. For example, DependencyInjectionTestExecutionListener
performs field injection without considering the previous value of the field.
In light of the above, we should simplify the field injection logic for Bean Overrides to align with the core container and the DependencyInjectionTestExecutionListener
.