Question

I'm new to Spring, and the Spring dogma, as I understand it, is to make your applications as least-reliant on the framework as possible. Any time I see some documentation or note that requires that your class be aware of the spring framework it always comes with a disclaimer that says that the approach is anti-spring in nature.

So my uninitiated curiosity wonders why have spring specific tag-libs and the equivelent velocity/freemarker macros for binding, form building, and validation? By doing this you are closely tying large chunks of your view layer to the Spring framework.

Isn't this anti-spring-like?

Was it helpful?

Solution

It's a choice, of course. Be wary of absolutes and dogma, both in software and in life.

Spring has lots of dependencies built-in. Accept them.

What Spring does is give you a lot of choices. When you choose to use common technologies like JSP or Velocity, Spring offers excellent support. If you don't want to rely on either one, by all means write your UI in terms of raw HTML, CSS, and JavaScript. It's your choice. Spring doesn't mandate anything.

I don't think the criticism is valid. Spring lets you use either JDBC or Hibernate. Is it wrong to have a dependency on Hibernate? If you say yes, don't use it. It's your choice.

UPDATE:

If you want one right way with everything, try Grails. It's based on Spring and Hibernate. A lot of the choices are made for you. It's like Ruby on Rails, except it uses Java, Groovy, Spring, and Hibernate.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top