@Singleton //This is the class I want to be injected
public class Helpers {
Helpers helpers;
@Inject
public Helpers getInstance(){
if(helpers != null)
return new Helpers();
return helpers;
}
@PostConstruct
public void init() {
System.out.println("######## CREATED #######");
}
}
class consumer{
@Inject
Helpers help;
public void hi(){
System.out.print(help.tostring());
}
public static void main(String args[]){
new Consumer().hi() // get null pointer exception
}
}