The introduction of AOT has added some more places where we need to work with the bean method attribute on a bean definition. We reduce the code duplication by extracting the logic into a shared class.