views:

1458

answers:

4
+1  Q: 

Spring vs Jboss

What are the advantages and disadvantages for Spring vs. Jboss for an enterprise web application.

+3  A: 

jboss is a container, spring is what runs inside the container. you are comparing apples to oranges man.

mkoryak
Maybe he means their dependency injection capabilities.
cherouvim
+1  A: 

Here's my opinion:

Spring represents all that is good in JEE, whereas JBoss represents all that is bad.

Well... that didn't go over so well (not that I thought it would). I'm just saying that I would never choose JBoss to host any application. It's just so clunky and heavyweight, and does not do anything particularly well. I like Spring because it feels less monolithic and clunky. Granted, Spring is not an application container, but it can be used to build up most of the infrastructure you need to host an app - you just have to plug it into a container, and Spring handles the rest.

Andy White
All you naysayers! :)
Andy White
Love this line "Spring represents all that is good in JEE, whereas JBoss represents all that is bad."
Anthony Kong
+1  A: 

As already said, but let me just restate the point. JBoss is an application server. Some Java application servers include

  • Websphere
  • Glassfish
  • JBoss

Spring is a framework. A rather large framework which offers quite a bit but for me one of the main features is MVC. MVC is a design pattern where you separate your Model from View from your Contoller. The model is the representation of the data. This can be backed by things like database or XML files. The view is what is used to view the model. This can be either web frontend or a windows application. The user will interact with the view. The user will express their desire for the model to be updated. This is where the controller comes in. We use the contoller to tell the model to update. And because the view is based on the model the view then gets updated too. This is over simplifying but in a nutshell. Other MVC framework that you can look at is Struts.

Like I said earlier there are other features that Spring offers such as

  • Security framework
  • Inversion Of Control
  • Dependency Injection
uriDium
+2  A: 

This is a good question. Some have incorrectly stated here that this is an apples to oranges comparison, i.e. Jboss is a container, and Spring is simply a framework, like Struts. However, the reason this is a bit confusing is that both JBoss and Spring have expanded considerably from their original, simple origins, and are thus moving closer towards each other. One easy way to understand JBoss is that the name was original "EJBoss", and it was intended on being an open-source J2EE application server, so it had the advantage over tomcat over serving as an EJB container, and thus could compete with WebSphere and other proprietary application servers.

And Spring was an IoC framework (now referred to as "Dependency Injection"), essentially a factory for objects so that you can follow a more "loosely coupled" design.

However, with their popularity, both products expanded. For example, JBoss now has it's own IoC container: JBoss IoC

And while Spring can run perfectly well, coexisting (mostly) happily with JBoss, it doesn't need a full-blown EJB container, it can run easily in tomcat. The whole design goal of Spring was based on the idea of lightweight design, and the use of POJOs, and the lack of requirement for a heavy-weight container, which was very contrary to EJBs, and thus would seem at odds with JBoss.

Rod Johnsonhas pointed out that there's no reason you can't run Spring in JBoss. So what you have to decide is what parts of the two systems you want to use. But according to this article, on JBoss and Spring, which covers how well they adhere to standards, it does seem, depending on which technology you select, you are picking a side, as this seems to be a pretty contentious battle, and one more indication that the Java world is somewhat divided within itself.

michaelok