Re: Testability EJB 3.0 (dependency injection of private members?)
Friday, October 10, 2008 11:04 AM
sorry better version
I'm very new to the EJB 3.0 stuff and it really sound nice so far. Its finally getting much easier.
I have a couple of questions about the new dependency injection and hope someone can help me out.
1.) can I only inject ejbs or resources? In spring you could inject every type of class (by using a factory or plain vanilla constructor)
2.) Lately I saw an example where dependency injection was used to inject an other ejb to a private member variable. there was no setter at all. Is the container able to inject even private members? it is best practice to avoid the setter?
3.) if the container can inject private member, am I able too? otherwise mocking the resources for testing would be impossible. best regards tom