Refactoring: provide a 'findMainType method that can be shared between CF and spring boot tooling.