resolveFactoryMethodIfPossible considers nonPublicAccessAllowed and SecurityManager

Issue: SPR-11422
Polishing

Issue: SPR-11422