Announcement Announcement Module
Collapse
No announcement yet.
Newbie Question - The Ideal Spring Solution Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Newbie Question - The Ideal Spring Solution

    Hi folks,

    I'm looking at possible architectures for a new project I'm working on. As I'm new to Spring, I'd like to ask some questions about what Spring can offer a new project. Apologies if I'm completely missing the point!

    Some questions:

    1) Why use Spring to access a framework like Hibernate? Surely this is just adding complexity to an application? Surely one of the compelling reasons of using Hibernate is to take away some of the pain in using a home-grown JDBC solution. Why not use Spring's own JDBC abstraction layer. Confused!

    2) I've lots of Struts/JSP experience. Why would one replace Struts with the Spring Web framework? Why would one integrate Struts with Spring (which I understand is possible) when just using Struts is simpler?

    3) If you were designing a completely new web application, which elements of Spring would you definitely use? Which would you leave behind? In short, describe an optimum application design which uses the Spring framework.

    Thanks in advance for your replies.

    Kind regards.
    cp.

  • #2
    Re: Newbie Question - The Ideal Spring Solution

    Originally posted by conorp
    Hi folks,

    I'm looking at possible architectures for a new project I'm working on. As I'm new to Spring, I'd like to ask some questions about what Spring can offer a new project. Apologies if I'm completely missing the point!

    Some questions:

    1) Why use Spring to access a framework like Hibernate? Surely this is just adding complexity to an application?
    I agree.. I have complexity.. and I especially hate complex webapplications (always something breaks/goes wrong and it costs time). But Spring gives you a very stable base you complete application is build/configured/managed in. I love it because I`m 110% back in the drivers seat.. Spring added some complexity.. but it remove a lot of complexity also.

    Surely one of the compelling reasons of using Hibernate is to take away some of the pain in using a home-grown JDBC solution. Why not use Spring's own JDBC abstraction layer. Confused!
    Spring is not a or-mapper. Spring only makes it easier to use existing or-mappers like hibernate.

    Spring doesn`t have a big influence on architecture imho. You can glue your bean togehter in Spring, and maybe enhance them (security/transaction), but as far as your normal objects are concerned.. spring doesn`t exist.

    2) I've lots of Struts/JSP experience. Why would one replace Struts with the Spring Web framework? Why would one integrate Struts with Spring (which I understand is possible) when just using Struts is simpler?
    I think both of them are bad. Model2 based webframeworks criple the mind.. But if you know struts and are happy with it.. it would use Struts. Spring doesn`t force you to use Spring-MVC. There even is a Struts plugin for Spring.

    3) If you were designing a completely new web application, which elements of Spring would you definitely use? Which would you leave behind? In short, describe an optimum application design which uses the Spring framework.
    It depends on the situation and on your needs. If you are making a 13 in a dozen webapplication.. hibernate/spring and a webframework (maybe you could have a look at tapestry/wicket/click)

    Comment


    • #3
      Hmm. I suppose what I'm confused about is the compelling reason to learn Spring when all I may use it for is it's abstraction over a data access framework (either Jdbc or Hibernate). It doesn't seem like a good reason to introduce yet another framework into an application.

      Why would I replace my Struts MVC layer with Spring MVC? What features does it give me that I don't get with Strusts?

      I must say, I decided to look into Spring because I heard I could develop in applications in less time, with less code. Based on this, which features of Spring give the most benefit?

      Thanks again.

      cp.

      Comment


      • #4
        I would go with spring mvc.

        The key thing for spring is plugability. The MVC "stack" is comprised of interface based collaborators for which you can provide your own implementation at any point.

        Don't want to use jstl, but want to use your own custom rendering, fine. Want to change how request parameters are bound to your form backing object. Fine.

        Sticking with a well known framework (spring MVC) buys you a lot of other people's experience

        Comment

        Working...
        X