Along with #35373 where we introspect Optional results from a Provider handle as well, it turns out that directly injected Optional handles are not being exposed in the autowiredBeanNames - as a consequence, they are not taken into account for registered bean interdependencies which may affect the shutdown order. This can easily be aligned in 7.0.2 as well.