Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization 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
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Spring vs Other frameworks

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the diferences and advantajes of using Spring MVC instead another web frameworks like Struts and JSF?
 
Ranch Hand
Posts: 69
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spring and Struts are MVC based architecture so at conceptual level they both work with Servlet centric architecture and requests are mapped to controllers. I would say Spring MVC and Struts provide a better way of handling url mapping and also a lot of other utilities to bring productivity,

JSF is different from MVC as it takes the abstraction to one level above where one deal with Swing kind of notion. Though JSF is also a MVC deep down but as an application developer you are not exposed to it. In JSF the values and action are directly bound to attributes and methods respectively on the back end.
 
best scout
Posts: 1294
Scala IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm often wondering if Spring has really advantages since the announcement of EJB 3.0 and JPA...

I now the whole Spring framework offers more sub components and frameworks that go beyond EJB but I'd like to know if Spring or EJB 3.0 is preferable at least for the functionality they have in common. Unfortunately I don't know Spring in Detail so I can't really compare it to EJB. What would you guys say?

Marco
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The major drawback of EJB 3 is DI works only for managed resources like Servlets, Enterprise Beans, Data Sources, etc.
You cannot inject POJO or simple types to Enterprise Beans.

Regarding AOP, Spring AOP has more features than EJB 3 Interceptors, but EJB 3 Interceptors are easier to use.
 
Marco Ehrentreich
best scout
Posts: 1294
Scala IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kengkaj,

the excellent AOP support in Spring is indeed a main difference I've seen, too.

Are there other really big advantages besides AOP and additional modules which are simply not part of EJB/JPA? When I read some short summaries or articles about Spring I often have the impression that most of the propagated advantages of Spring (or disadvantages of competing technologies) are already solved by EJB 3.0. And the updated versions of EJB and JPA sound even more promising. Not to forget that EJB is an official standard (which of course is not always an advantage).

So am I missing something fundamentally or is it like so often that a lot of all the hype is a kind of personal taste?

Marco
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Marco Ehrentreich wrote:
So am I missing something fundamentally or is it like so often that a lot of all the hype is a kind of personal taste?


As I said, EJB 3 DI cannot compare to Spring, Spring is an IoC container whereas EJB 3 was designed to simplify Java EE development.

If you use Spring, you will understand how serious it is if you cannot inject POJOs. For me, if I will not use EJB 3, the main reason would be its weakness in DI.

Anyway, did you know that using Spring doesn't prevent you to use EJB?
Spring provides EJB integration, you can read at http://static.springframework.org/spring/docs/2.5.x/reference/ejb.html.
 
Ranch Hand
Posts: 686
Netbeans IDE Chrome Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will give you another simple reason in favor of Spring:

You can run Spring on Tomcat and not worry about app servers. This is big for small companies who don't want to leap into the app server space or shell out $. Tomcat has helped keep out environment very clean.
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The main difference between EJB and Spring Framework is EJB container is heavyweight but Spring Framework is a lightweight container.

Transaction management in EJB works for enterprise beans only, this means that if we want to make a class transactional, we have no choice but make it EJB.
The same goes for security, if we want to apply declarative security to a class in EJB, we have no choice again (so sad ), but to make it EJB.

But for Spring, it can make *any* classes transactional. Spring also offers declarative rollback rules (no EJB equivalent).
However, Spring Framework doesn't support propagation of transaction contexts across remote calls.
For more information about transaction management in Spring Framework, please read http://static.springframework.org/spring/docs/2.5.x/reference/transaction.html.

About security, Spring Framework doesn't have built-in security feature as EJB, but we can use Spring Security (formerly known as Acegi Security). And of course, when using Spring we can apply security to any classes.
 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Netbeans IDE Chrome Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice reply
 
César Guzmán
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Vyas Sanzgiri wrote:
You can run Spring on Tomcat and not worry about app servers. This is big for small companies who don't want to leap into the app server space or shell out $. Tomcat has helped keep out environment very clean.



You make a very important observation, so Spring resolves transaction management(among much more things) in a cheap way, big deal as you said for small companies talking about money $, it's like a small app container, thanks everyone by the tips, this is very helpful, to know what technology to use on particular situations it's a very important issue to every project.
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Talk about money, there are free Java EE application servers available such as GlassFish, JBoss AS, Apache Geronimo.
 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Netbeans IDE Chrome Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know but I (and management) don't want to re-test 100+ applications on other app server. It is much easier just to add spring.jar and start the container :-)

 
Ranch Hand
Posts: 398
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kengkaj Sathianpantarit wrote:Talk about money, there are free Java EE application servers available such as GlassFish, JBoss AS, Apache Geronimo.



Tomcat is a lightweight, cost-effective and simple solution compared other app servers you mentioned.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tomcat is a lightweight, cost-effective and simple solution



Yes I vote for Tomcat.
 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Mourouganandame Arunachalam wrote:

Kengkaj Sathianpantarit wrote:Talk about money, there are free Java EE application servers available such as GlassFish, JBoss AS, Apache Geronimo.



Tomcat is a lightweight, cost-effective and simple solution compared other app servers you mentioned.



But Tomcat is not application server, I like JBoss in free application servers.
 
Padmapriya Ranganathan
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sagar Kale wrote:
But Tomcat is not application server, I like JBoss in free application servers.



Have a look at this Link... may be bit old, but provides answers for your claim
 
Mourouganandame Arunachalam
Ranch Hand
Posts: 398
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sagar Kale wrote:

Mourouganandame Arunachalam wrote:

Kengkaj Sathianpantarit wrote:Talk about money, there are free Java EE application servers available such as GlassFish, JBoss AS, Apache Geronimo.



Tomcat is a lightweight, cost-effective and simple solution compared other app servers you mentioned.



But Tomcat is not application server, I like JBoss in free application servers.



you can read this thread... very interesting info shared by our experts....
 
Sagar Kale
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Padmapriya Ranganathan wrote:

Sagar Kale wrote:
But Tomcat is not application server, I like JBoss in free application servers.



Have a look at this Link... may be bit old, but provides answers for your claim



Doesn't matter if there is no specific definition of application server but it is understood in java community ( many may not agree though ) that server which implements J2EE ( JEE ) specifications are called application server. Tomcat does not fully implement J2EE ( JEE ) specifications. Though Tomcat is popular because it is easy to use, but I do not consider it application server.
 
Mourouganandame Arunachalam
Ranch Hand
Posts: 398
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sagar Kale wrote:
Doesn't matter if there is no specific definition of application server but it is understood in java community ( many may not agree though ) that server which implements J2EE ( JEE ) specifications are called application server. Tomcat does not fully implement J2EE ( JEE ) specifications. Though Tomcat is popular because it is easy to use, but I do not consider it application server.



If this is your own definition, you can use it to believe. Otherwise, provide the source reference.
 
Sagar Kale
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Mourouganandame Arunachalam wrote:

If this is your own definition, you can use it to believe. Otherwise, provide the source reference.



Link


Wikipedia
Read following line on the page.
Tomcat from Apache and JOnAS from ObjectWeb are typical of containers into which these modules can be put.

Link


oreillynet

oreillynet.com defines it like this.

The Tomcat server is a Java based Web Application container that was created to run Servlets and JavaServer Pages (JSP) in Web applications. As part of Apache's open source Jakarta project, it has nearly become the industry accepted standard reference implementation for both the Servlets and JSP API. Written by expert Servlets and JSP software architect and author James Goodwill, this column will feature introductory Web application development issues, Tomcat installation and configuration, deploying Web applications onto Tomcat, Struts and much more.


If you want to discuss it further, start a new thread for it.




 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Netbeans IDE Chrome Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe the last few replies have diverged from the original topic
 
Mourouganandame Arunachalam
Ranch Hand
Posts: 398
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sagar Kale wrote:

Mourouganandame Arunachalam wrote:

If this is your own definition, you can use it to believe. Otherwise, provide the source reference.



Link


Wikipedia
Read following line on the page.
Tomcat from Apache and JOnAS from ObjectWeb are typical of containers into which these modules can be put.

Link


oreillynet

oreillynet.com defines it like this.

The Tomcat server is a Java based Web Application container that was created to run Servlets and JavaServer Pages (JSP) in Web applications. As part of Apache's open source Jakarta project, it has nearly become the industry accepted standard reference implementation for both the Servlets and JSP API. Written by expert Servlets and JSP software architect and author James Goodwill, this column will feature introductory Web application development issues, Tomcat installation and configuration, deploying Web applications onto Tomcat, Struts and much more.


If you want to discuss it further, start a new thread for it.








Yes but none of the links claims Tomcat is NOT an application server. Moreover, there is no official standard specification for application servers. So, it's based on individual's decision. If you want to call Tomcat as servlet container and not an application server, then it's up to you. This has been already discussed in a separate thread which I have given reference above, so no need to discuss again, which is meaningless.
 
Sagar Kale
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yes but none of the links claims Tomcat is NOT an application server.


Looks like you did not bother to read links.

 
Sagar Kale
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now if you want to call Tomcat application server, you can call it and get happy. For me it is Servlet/JSP Container.

Run EAR which has EJB2.0 module in Tomcat and get happy.
Anyway there are many who claim Tomcat as application server because they like easy things to work with.
 
Did you just should on me? You should read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!