There is my presentation for JEEConf 2017 where I am going to show how you can write your custom IoC framework.
https://github.com/sshogunn/custom-ioc-tdd
17. Unit Testing IoC example
@Test
public void shouldDoDomethingWhenSomethingElseHappened() {
//GIVEN
//WHEN
//THEN
}
def "#person.name is a #sex.toLowerCase() person"() {
expect:
person.getSex() == sex
where:
person || sex
new Person(name: "Fred") || "Male"
new Person(name: "Wilma") || "Female"
}
Is called by
Is called by
17
18. DI and IoC example
Who is this magic "injector"?
18
46. Singleton Scope
A singleton’s context is the
injector
itself. The life of a singleton is
tied to the life of
the injector
Application
Injector 1
Injector 2 Injector ...
Injector N
46
47. Singleton Scope vs Singleton
For Singleton Pattern, it's
true, but per
For Singleton Scope, it's
true, but per
47