I am learning Spring and the term "Spring Container" frequently shows up in the text. However, I know "container" is not used only in Spring (EJB container etc) so what does it mean when used in the context of programming?
Containers are a form of operating system virtualization. A single container might be used to run anything from a small microservice or software process to a larger application. Inside a container are all the necessary executables, binary code, libraries, and configuration files.
Containers are the interface between a component and the low-level, platform-specific functionality that supports the component. Before it can be executed, a web, enterprise bean, or application client component must be assembled into a Java EE module and deployed into its container.
A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT components. Components added to a container are tracked in a list. The order of the list will define the components' front-to-back stacking order within the container.
The container is something that contains something else.
In spring: Spring container contains beans (Java objects that are subject to dependency-injection)
Servlet containers contain servlets, filters, listeners, etc. and manages their state and lifecycle. There are also similar portlet containers
EJB containers contain EJBs (stateless, stateful, message-driven) and, as above, manage their pooling and lifecycle
java.awt.Container
"is a component that can contain other AWT components"
As you can see the role of the container is to own and manage a set of objects so you don't have to instantiate them directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With