posted 13 years ago
When I just dependency injection such as Spring or Google guice, I always have to define a context which contains all the classes that will be initialized by DI framework, and also defines all the dependencies will be injected into those classes. Such as
<bean id="someClass" class="..">
<property name="someProp" ref="someOtherBean"/>
</bean>
What I think in this case is that the DI framework initialize the class and call set method to add dependencies.
But in application container, I don't have to define those kind of context, how could container know which classes can be injected?
Or application container can only inject certain classes based on anotation, such as:
@PersistenceUnit(unitName="..")
private EntityManagerFactory emf;
If I want to be able to inject my own classes, I still have to use some other framework?