check if bean is null when getting Class