Spring MVC Framework easy?

Go To StackoverFlow.com

0

I m a newbie & i m good at Struts framework. Today i tried a tutorial for Spring MVC Framework.

The example url that i tried following is as below:

http://static.springsource.org/docs/Spring-MVC-step-by-step/part6.html

I think they have made this tutorial much more complex especially near its end. I saw some errors mainly typos in part 5, part 6 of tutorial. I found Spring framework as not properly organized and how would we know what classes to extend especially when their names are so weird (pardon my language) e.g. AbstractTransactionalDataSourceSpringContextTests.

Overall i found that Spring is making things much more complex than it should be. I'm surprised why there is such a hype about Springs being very easy to learn.

any suggestion how to learn spring easily ? how to judge what to extend ? is there a quick reference or something?

2012-04-04 02:23
by Neeraj
Just googling for "spring mvc tutorial" returns a boatload of good pages. Unless you have a specific problem, asking here probably won't get you more than what you would get simply searching the internet - pap 2012-04-04 07:30


3

The tutorial you have referred to covers all the layers of the application - data access, business logic and web. For someone who is looking to only get a feel of Spring MVC, which addresses concerns specific to the web layer of the application, this could be more information than required. Probably that is why you got the feeling that the tutorial is complex.

To answer your questions, Spring is easy to learn because the whole framework is designed to work with POJOs, instead of relying on special interfaces, abstract classes or such. Developers can write software as normal Java applications - interfaces, classes and enums and use Spring to wire the components up, without having to go out of the way to achieve the wiring. The tutorial you have referred to tries to explain things in a little bit more detail than experienced programmers would typically do in a real application, probably because the authors wanted the readers to get enough insight into how Spring works so that concepts are understood well.

In most applications (regardless of their size or nature), there is typically no need to extend Spring classes or to implement specialised classes. The Spring community is quite large and an even larger ecosystem of readily available components exists that integrate with Spring. It is therefore very rare that one has to implement a Spring component to achieve something. For example, let us take the example of the data access layer. Different teams like using different approaches to accessing databases. Some like raw JDBC, others like third-party ORMs like iBatis or Hibernate while some others like JPA. Spring distributions contain classes to support all these approaches. Similarly, lets say someone was looking to incorporate declarative transaction management in their application. Again, transaction management can be done in many different ways and a large number of transaction management products are available for people to use. Spring integration is available for most of these products, allowing teams to simply choose which product they want to use and configure it in their Spring application.

Recent Spring releases have mostly done away with extensive XML based configuration files, which being external to the Java code did make Spring application a bit cumbersome to understand. Many things can be done nowadays with annotations. For example,

@Controller
public class AuthenticationController
{
    ...
}

Indicates that AuthenticationController is a web MVC controller class. There are even ways to avoid using the Controller annotation and follow a convention-over-configuration approach to simplify coding even further.

A good and simple tutorial to Spring MVC is available at http://www.vaannila.com/spring/spring-mvc-tutorial-1.html. This tutorial uses XML based configuration for Spring beans instead of annotations but the concepts remain the same.

2012-04-04 04:06
by manish
Thank you So much Appreciate your comments, it really clarifies my doubts! I m on my way to Spring now!! - Neeraj 2012-04-04 14:57


0

I have seen tutorial you follow , Its seems you have follow wrong one first , you first tried to simple one, Instead of tutorials you should go for book first I recommend you two books to understand the power of Spring

spring in action and spring recipes.

For practical you can use STS a special ide for spring project development.Its have some predefined template you dont't need to write whole configuration yourself.

In starting just see simple tutorials like Spring mvc hello world , form controller than go for big ones

Spring is very cool , All the best.

2015-02-17 12:22
by himanshu bisht