For legacy and other reasons I'm not able to use JPA repositories. So I'm trying to build something similar for a project. I have class MyEntityRepo
@Repository
public class MyEntityRepo extends CustomRepository<MyEntity, Integer> {
}
And
public abstract class CustomRepository<T, ID> {
    private static final Logger LOG =LoggerFactory.getLogger(CustomRepository.class);
    protected SessionFactory sessionFactory;
    private T _clazz;
    private String className;
    public CustomRepository() {             
        String className = _clazz.getClass().getName();
        if (className.contains(".")) {
            className = className.substring(className.lastIndexOf('.') + 1);
        }
        LOG.info("classname:{}", className);
    }
}
But when I'm starting the project, the spring framework is not able to create the bean as it is giving NullPointerException because _clazz field is null. Can somebody please explain how to achieve this?