This week's book giveaway is in the Web Services forum.
We're giving away four copies of Microservices in Action and have Morgan Bruce & Paulo A. Pereira on-line!
See this thread for details.
Win a copy of Microservices in Action this week in the Web Services forum!
  • 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Spring Container Queries  RSS feed

 
Ranch Hand
Posts: 370
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?
 
Bartender
Posts: 19996
95
Android Eclipse IDE Linux
  • 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.
 
Rancher
Posts: 985
9
Java Linux Spring
  • 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
Bartender
Posts: 19996
95
Android Eclipse IDE Linux
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!