小马哥课程笔记
IoC 容器的职责
维基百科(https://en.wikipedia.org/wiki/Inversion_of_control) 在 Overview 小节中提到:
“Inversion of control serves the following design purposes:
- To decouple the execution of a task from implementation.
- To focus a module on the task it is designed for.
- To free modules from assumptions about how other systems do what they do and instead rely on contracts.
- To prevent side effects when replacing a module.
Inversion of control is sometimes facetiously referred to as the “Hollywood Principle: Don’t call us, we’ll call you”.”
IoC 容器的职责
IoC 容器
-
主要实现
- Java SE
- Java Beans
- Java ServiceLoader SPI
- JNDI(Java Naming and Directory Interface)
- Java EE
- EJB(Enterprise Java Beans)
- Servlet
- 开源
- Apache Avalon(http://avalon.apache.org/closed.html)
- PicoContainer(http://picocontainer.com/)
- Google Guice(https://github.com/google/guice)
- Spring Framework(https://spring.io/projects/spring-framework)