I have a question about the @Inject
annotation in java ee 6 :
What is the difference between :
@Inject
private TestBean test;
@Inject
private Instance<TestBean> test2;
To have the reference :
test2.get();
Some infos about Instance : http://docs.oracle.com/javaee/6/api/javax/enterprise/inject/Instance.html
Maybe it's doesnt create the object until it's called by get() ? I just wanted to know which one is better for the jvm memory. I think direct @Inject
will directly create an instance of the object , even if it's not used by the appplication...
Thank you !