package baseDao;
public interface BaseDao {
public void create(Object obj);
public void delete(Object obj);
public void update(Object obj);
public void
You are trying to initialize session object, when usernameSessionFactory object is not initialized yet.
In a class, all Spring @Autowired objects are initialized just after the construction of the instance of such class is done.
private Session session = usermanagementSessionFactory.getCurrentSession();
But if an instance decleared in a way like the above code, will be initialized earlier than construction, in a way that they can even be used as parameters of construction.
@Autowired
private SessionFactory usermanagementSessionFactory;
private Session session;
@PostConstruct
public void init() {
session = usermanagementSessionFactory.getCurrentSession();
}
Above code, will initialize session object after the construction, which means usermanagementSessionFactory is ready and not null.
Hopefull it helps..