Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "Container" mean in the context of programming?

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?

like image 431
LuckyLuke Avatar asked Mar 16 '12 08:03

LuckyLuke


People also ask

What is a programming container?

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.

What is container in context of Java?

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.

What is a container object in Java programming?

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.


1 Answers

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.

like image 178
Tomasz Nurkiewicz Avatar answered Sep 28 '22 17:09

Tomasz Nurkiewicz