• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Spring Container Queries  RSS feed

 
Ranch Hand
Posts: 391
2
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose we have a Spring MVC application running on Tomcat/WAS. I would like to understand

1. how the spring container is loaded ?

2. When is it loaded?


3. Can we have multiple instances of spring container?
 
Saloon Keeper
Posts: 20639
122
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said tou you here, I don't think I'd use the term "Container" for Spring. Spring is a provisioner and a configurator, and it supplies a number of frameworks, but the actual "container" for a webapp is the deployed WAR in the webapp server.

And since Spring is not a standard J2EE or JEE service provided by the container, that means that each webapp has to include Spring (or not) if it needs it as part of the WAR.

It's "loaded" as simply another set of classes the same way all classes are loaded. There's no Spring Thread or process, just a Factory that the application can draw upon whenever it needs a particular bean.

And the answer to your third question was given in the other message thread I mentioned.
 
Bartender
Posts: 1010
18
IntelliJ IDE Java Linux Mac OS X Oracle Redhat Spring Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could start here; Spring Framework’s Inversion of Control (IoC) container.  

You could have many instances of the application context (IoC), but I'm not sure why would would do so.  If you wanted different configurations dependant upon runtime environments (for example for development, testing, live production) then springs profiles are designed to offer that functionality.    

Note that the term "container" has became one of the overused terms in computing.  It now has different meanings depending on the subject matter.  
The Spring IoC does not have much in common with other technologies that use the same term (like docker or JEE).  
 
Tim Holloway
Saloon Keeper
Posts: 20639
122
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Peter Rooke wrote:The Spring IoC does not have much in common with other technologies that use the same term (like docker or JEE).  



Which is why I don't like to call it a container, despite what the official docs say.

As containers go, it's a leaky one. Although technically it can manage beans over their entire lifecycle, in actuality a raw bean, once manufactured and returned to application code is mostly on its own.
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!