i have @Autowired the sessionFactory bean in my class and then I instantiated that class at runtime and when I call the method, it is throwing a nullpointer exception. I don't know what I'm missing in my code. It compiles successfully and when i run it, it's throwing a nullpointer exception. Can someone please help me?

here is my class:

```
public class InstantiateSampleAutowire{

    SampleAutoWire sampleAutowire = new SampleAutowire();
    sampleAutowire.getSomeData();

}

@Component
public class SampleAutowire{

    @Autowired
    private SessionFactory sessionFactory;

    private Session getCurrentSession() {
        return sessionFactory.getCurrentSession();
    }

    public void getSomeData(){

        getCurrentSession().createQuery(SQLQuery);

    }

}

```