01
Core Concepts
The trace left in the source by handing an object's lifecycle over to a container, a dependency being supplied through the constructor and its effect on testability, component scopes splitting between a default and an annotation, the precedence order of configuration sources, automatic configuration that kicks in when there is no annotation at all, and cross-cutting concerns being wrapped without touching the call site.
- 01 Inversion of Control An IoC container derives an object's construction, the return of the same instance, and a manually new-built instance receiving none of the annotations at all from three separate sources: of twelve behaviors, three come from a call in the source, six from an annotation alone, three from the container's own default.
- 02 Dependency Injection When an IoC container supplies a dependency through the constructor, it is born from an annotation; the same dependency given by hand is born from a call standing in the source — and the same class works with both. When no implementation is bound to an interface, the container throws an exception immediately, but not while the container is being built — at the first request.
- 03 Component Scopes and Lifecycle A managed component staying a singleton is the IoC container's default decision; being reconstructed on every call comes from an explicitly written scope annotation. An unrecognized scope name throws no error at all — the component silently stops being a singleton, and this is only visible by comparing two requests' identity with ==
- 04 Configuration Sources A setting value comes from one of three sources, and the precedence order is the IoC container's own rule — it never appears anywhere in the source: a value given from outside overrides a file source, and a file source overrides an embedded default. A misspelled setting name never disturbs the container at all — the program silently falls to the embedded default and reads empty instead of full.
- 05 Automatic Configuration If no component is declared for an interface, the IoC container puts its own default implementation in place; when the user declares their own component, the container silently steps back and never installs its own default at all. What is automatic is conditional, and that condition appears nowhere in the source with any word at all.
- 06 Aspect-Oriented Programming A wrap marker placed on a managed component adds behavior without ever touching the call site: a cross-cutting concern (a counter, in this example) steps in on every call, and the mechanism is a proxy. But the marker existing does not mean it is applicable — the same marker placed on a class with no interface stays ineffective without throwing any error at all.