The best way to understand how complex an IoC container comes from analyzing it.
In some specific experience, when I spent the whole day debugging some simple Hello World code using plexus , which is Maven based on ( and here is a useful link for viewing the source code ). This came up (by looking at defaultPlexusContainer) as:
- Class Configuration (via classworlds)
- Creating a run-time context variable (mainly a map) to store properties and variables
- Configuration analysis (detection of module metadata on the way to classes, etc.)
- Initialization:
- Building / Creating Services
- Dismissal of additional ComponentDiscoverers
- Dismissal of additional ComponentDiscovererListeners
This leaves an important aspect, deep in the above steps: component search. In the plexus, the concept of phase wraps up the steps for building an object, and these phases are usually associated with the concept of personality. However, for the default parameter , this is done by performing the following steps:
- Object activation (i.e. new object ())
- Enabling the log (i.e. setting the registrar for the object)
- Composition: i.e. dependency search and customization
- The setter strategy is an interesting point, but for now I will leave the details
- Passing Context to the Created Object
- Additional object launch procedure
Most of these steps are optional and usually include the identification of this interface and calling it on the target object - this is the default value for the plexus personality, please note that.
In addition, each object can be tied to a life cycle manager, which basically makes the difference between a new object and a single.
In my specific entry: the hardest part is parsing the configuration and loading the container. After that, you most likely will not notice further differences in performance.
aldrinleal
source share