Help coderanch get a
new server
by contributing to the fundraiser
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring Container ?

 
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello authors,
From the previous posts i could understand that, Spring doesnot need a heavy container ( aka application server which EJBs need ). As far my knowledge, an EJB container comes packaged with the app server.
Now if i need to use Spring in my project, where will the container be hosted?
From where can i get the Spring container? I hope my question is clear.
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Craig has replied to a similar query here https://coderanch.com/t/59837/oa/Spring-EJB

Download
www.springframework.org
 
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Reghu Ram T:
Hello authors,
From the previous posts i could understand that, Spring doesnot need a heavy container ( aka application server which EJBs need ). As far my knowledge, an EJB container comes packaged with the app server.
Now if i need to use Spring in my project, where will the container be hosted?
From where can i get the Spring container? I hope my question is clear.



Don't confuse the Spring container with a heavier EJB container. They're very different concepts.

The Spring container is really not much more than a factory that loads up beans and figures out how to wire up dependencies. That's it. I like to think of it as as really smart HashMap.

But because it's so lightweight, it doesn't need an application server. Certainly, it can run within the context of an application server, but it can also run just as easily within a desktop application. So it doesn't need to be hosted anywhere.
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Craig Walls:



The Spring container is really not much more than a factory that loads up beans and figures out how to wire up dependencies. That's it. I like to think of it as as really smart HashMap.

.




Craig,
Isn't it wrong then to use the word container?
:roll: Thanks
 
Craig Walls
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pradeep Bhat:
Isn't it wrong then to use the word container?
:roll: Thanks



No...not really. It really depends on your definition of "container". In the purest sense of the word, a HashMap is a container.

Think of it this way: Let's say you have a HashMap and in this HashMap you have all of the beans that make up your application. Now imagine that this particular implementation of HashMap has code that automatically loads all of the beans it holds from an XML file. Now imagine that it's even smart enough to figure out how to wire up dependencies between all of those beans.

At that point you have an IoC container. Granted Spring's container does a lot more, but that hypothetical implementation of HashMap is an IoC container, nonetheless.
 
Reghu Ram Thanumalayan
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
So the Spring Container is a factory that loads up the beans and knows how to wire them together ie inject the dependency between the objects unlike the heavy EJB container which does more things like transactions, security etc.

Thanks for the replies Craig.
 
Craig Walls
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Reghu Ram T:
Hi,
So the Spring Container is a factory that loads up the beans and knows how to wire them together ie inject the dependency between the objects unlike the heavy EJB container which does more things like transactions, security etc.



No, I gotta stop you there. The Spring container itself does not provide transactions and security, that's true. But the Spring framework (the container and all of the other classes that come with Spring)
does provide support for declarative transactions (see chapter 5 of Spring in Action). And the Acegi security framework adds declarative security (see chapter 11).

To say that Spring doesn't support transactions and security is wrong. But if we're talking about only the Spring container, then yes, it is only a "bean-wirer".
 
Reghu Ram Thanumalayan
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So to sum it up, the Spring framework supports declarative transactions, security and it also consists of the Spring container whose only job in the world is to wire together objects (invert the dependency).
Or am i missing something here ?
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Reghu Ram T:
So to sum it up, the Spring framework supports declarative transactions, security and it also consists of the Spring container whose only job in the world is to wire together objects (invert the dependency).
Or am i missing something here ?



You got it right.
 
Craig Walls
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Reghu Ram T:
So to sum it up, the Spring framework supports declarative transactions, security and it also consists of the Spring container whose only job in the world is to wire together objects (invert the dependency).
Or am i missing something here ?



That's pretty close...close enough to get started.

The Spring framework is a collection of several useful features, one of which is an IoC container (the bean-wirer). The container's primary function is to wire beans together, but it also provides a few other features such as the ability to resolve text messages (including I18N support), a generic way to load file resources (such as images), and it can publish events to beans that are registered as listeners.

In addition to the container, Spring has several useful subframeworks, including an AOP framework, an MVC framework, and abstractions for JDBC/ORM, e-mail, remoting, JNDI, scheduling, and (yes, even) EJB. All of these frameworks are built upon the core container.

Then, built on top of Spring AOP and JDBC/ORM abstraction layers, Spring provides support for declarative transactions. Likewise, built upon Spring AOP, Acegi adds support for declarative security.
 
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Craig Walls:


Don't confuse the Spring container with a heavier EJB container. They're very different concepts.

The Spring container is really not much more than a factory that loads up beans and figures out how to wire up dependencies. That's it. I like to think of it as as really smart HashMap.

But because it's so lightweight, it doesn't need an application server. Certainly, it can run within the context of an application server, but it can also run just as easily within a desktop application. So it doesn't need to be hosted anywhere.




Can Spring be used in conjunction with a high volume site which may use multiple managed servers with about 1000 threads available to serve the functionality??

Example: verizon.com, cingular.com etc.

My question is, if spring is proven in a distributed setup where a crop of managed servers are taking care of business functionality???
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kishore Dandu:


My question is, if spring is proven in a distributed setup where a crop of managed servers are taking care of business functionality???



To an extent it has been answered

here

Spring makes it easy to work with middleware infrastructure services ( allows us to apply them on a pojo) and encourages good coding practices by enforcing them through its libraries?.
It has built nice abstractions on top of the actual service providers.
Now that you refer to Thread Pool ,it does not have a User Request Queue in-built. But a tomcat/weblogic has one. So access to Spring can be controlled by employing the thread pooling features of the containers.
Spring alone cannot accomplish all tasks. In a web environment, it defintely needs to collaborate with a servlet/ejb container to do anything useful, the latter i understand is not a must.


Can Spring be used in conjunction with a high volume site


in 'conjuction', definitely yes.Spring does not have anything inherent that could make things worse. Uhhm, on 2nd thoughts I dont have insights into Spring AOP performance. I mean Spring middleware services are configured through Spring - AOP which in turn are jdk dyna proxies for interfaces and i *think* cglib for classes. But the time it takes to intercept a request and apply services shouldnt be a considerable factor in the overall performance figures.
 
Because those who mind don't matter and those who matter don't mind - Seuss. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic