Extract getServletContextInitializerBeans logic

Extract the hairy logic from getServletContextInitializerBeans() to a
new class and refactor things a little.
Fix typo

Fixes gh-1463
Polish