Fix potential NPE

This commit fixes a potential NPE when determining the priority of a
bean instance in case multiple candidates exist and no bean was marked
as @Primary

Issue: SPR-12024