r/java • • Mar 24 '21

17 years since Spring Framework 1.0 was released

https://spring.io/blog/2004/03/24/spring-framework-1-0-final-released
227 Upvotes

42 comments sorted by

12

u/vladmihalceacom Mar 24 '21 edited Mar 24 '21

I remember reading the PDF manual in the autumn of 2014. I was impressed by the quality of the writing and was sold right away.

22

u/BadMoonRosin Mar 24 '21

Honestly, I believe that the quality of documentation is how Spring "won" (in the U.S. and Asia, at least).

Dependency injection itself is a fairly straightforward concept, but Spring has never been "simple". A Spring Boot app today CAN be simple, but it carries along with it a ton of legacy complexity under the hood for backwards compatibility. Likewise, pre-Boot legacy Spring was far more complicated than needed, because of the times in which it emerged. Back then, the community believed in everything being loosely-coupled to the extreme. Frameworks had to be designed in such a way as to "not touch" your code, so that we could live under the fantasy that we might someday swap frameworks without a major re-write.

However, Spring overcame these issues by having the best documentation of any framework I have ever worked with in any ecosystem, bar none. Back in my old J2EE days, I had to go training classes to make heads or tails of how to simply build and deploy an EJB, much less write the code. With Spring, it was just straightforward breezy reading.

Yeah, there are O'Reilly and Manning books out there. But honestly, I've never found a book that I would recommend to newcomers more than the Spring Framework user guide / reference doc. Occasionally I have to search for something on StackOverflow or blogs, but more than 90% of the time, it's just right there in the doc.

0

u/[deleted] Mar 24 '21

[deleted]

3

u/wildjokers Mar 24 '21

I'm talking about this. Why can't you see all the sub-menus without clicking on their parents which leads to navigating to them? And why do the menus fold as soon as you click on another parent?

OMG, I thought I was the only one annoyed by that. I absolutely despise the current menu navigation in the Spring docs. I want to see all the sections so I have context about where I am in the doc. And so I can find my way back to the section I was just reading. The closing of the current section when I click on another parent is indeed a special kind of abomination.

2

u/[deleted] Mar 24 '21

I'm just starting to learn it now. The docs are pretty good (certainly compared to a lot of other projects, such as Docker). I still with every page had a link at the top to the same page but the latest version. Google randomly picks different versions.

2

u/chacs_ Mar 24 '21

I remember printing out the PDF, reading through and learning every aspect of Spring. Sadly this is no longer possible. 😁

6

u/randgalt Mar 24 '21

Always worth referencing this chestnut: http://blog.crazybob.org/2006/01/i-dont-get-spring.html

5

u/vladmihalceacom Mar 24 '21 edited Mar 24 '21

That's from Bob Lee, the creator of Guice, ex-CTO of Square. In 2006, Spring was still a very young framework using lots of XML configs, so some of his concerns were true at the time. However, they've all been addressed and fixed a very long time ago.

What I've always liked about Spring is that I could easily customize it to any unusual requirement I had to implement:

Not to mention projects like Spring Data which makes it so easy to implement a data access layer. Or, Spring Integration which allows you to implement ETL processes.

10

u/[deleted] Mar 24 '21

Interestingly, I used Crazy Bob's DI container, Guice, before I used Spring. In fact, when I first encountered Spring, I thought it was lame. Guice's DI was way better.

But, the thing that eventually won me over, despite Spring's way worse DI than Guice (everything Crazy Bob says is true) was the fact that Spring integrates with everything. Every library that I wanted to use had Spring integration. There are Spring integrations for Hibernate, Struts, MyBatis, pretty much anything I was using. So I eventually gave in to Spring.

3

u/randgalt Mar 24 '21

Spring is like .NET - if you take the full Monty from Microsoft everything works reasonably. As soon as you want to do something different, though, you're on your own and will fight against the massive framework you've taken in. Large frameworks own your application. It's better to use small components that do one or two things very well.

12

u/[deleted] Mar 24 '21 edited Mar 24 '21

As soon as you want to do something different, though, you're on your own and will fight against the massive framework you've taken in.

Oh yes, the other thing about Spring. Spring is the living embodiment of the Open/Closed Principle. Almost every key Spring component has a million different extension points. Finding them can be hard, because they're not exactly well documented, but if you're comfortable reading the Spring Framework source code, you can tweak Spring's behavior to your heart's content.

For example, take RestTemplate. If you want to use the Apache HTTP client instead of the native Java HTTP client, just provide the appropriate implementation of ClientHttpRequestFactory. If you're dealing with a custom HTTP client that has weird behavior (for example, this HTTP client I had to use for our internal SSO), you can adapt one or two of a number of interfaces to work around the HTTP client behavior, and still use RestTemplate none the wiser.

I've been able to adapt numerous components this way, like Spring Batch, Spring Integration, Spring Data, Spring MVC and Spring JMS.

It's better to use small components that do one or two things very well.

Perhaps, but Spring just makes it easier to wire together all the different kinds of dependencies that come with an enterprise application. I know I can't be the only one who thinks that way, considering Spring's popularity, especially in enterprise.

-2

u/randgalt Mar 24 '21

Maybe it's gotten better. I tried to do a simple Dependency binding at runtime and could not figure out how to do it. SO suggested it wasn't possible. In a way, this is .NET as well - there are so many different versions of Spring it's very difficult to get an authoritative answer for what is currently possible.

5

u/[deleted] Mar 24 '21

It's a 17 year old framework that undergone numerous changes over the years, what do you expect?

For me, the easiest path to an authoritative answer is just read the source code, which is highly accessible. It's a lot easier than trawling SO.

-5

u/randgalt Mar 24 '21

I don't understand why people put up with it. Yes, it's been 17 years and there are much better tools out there.

3

u/[deleted] Mar 24 '21

Spring integrates with everything. Every library that I wanted to use had Spring integration. There are Spring integrations for Hibernate, Struts, MyBatis, pretty much anything I was using. So I eventually gave in to Spring.

There may be better tools out there, but Spring keeps chugging along because it keeps doing what it does well, integration, flexibility and adaptibility. Why has Spring lasted for 17 years?

3

u/randgalt Mar 24 '21

Java integrates with everything. Are people really having trouble consuming Java libraries? Again, I don't get it. I'm able to use whatever library/framework/tool I want because of Java. I don't require a Spring wrapper around it.

4

u/[deleted] Mar 24 '21

Java integrates with everything.

At a low level, by providing a VM. Spring integrates at a much higher level.

Are people really having trouble consuming Java libraries?

Yes. Spring came into existence because of its DI, but has outlasted superior DI options because it makes consuming Java libraries easier. Obviously, Spring's popularity means it has tapped into some essential need.

I don't require a Spring wrapper around it.

Obviously, Spring is not a hard a requirement for anything. But the Spring wrappers are obviously very useful, which again, is why Spring is so popular and has lasted for 17 years.

Different strokes for different folks. If you don't get it, that simply means you have a different mindset than other developers, which is okay.

5

u/ataskitasovado Mar 24 '21

Why would I want to express all of my dependencies in XML?

On that part he was correct. Probably more things. Lesson learned here is that a good framework does not have to be perfect from day one. And Spring has reinvented itself many times during these 17 years.

1

u/dpash Mar 24 '21

I definitely don't miss wiring everything up by hand. I moved to autowiring asap (amusingly Bob takes aim at that) and moved to annotations once they became functional.

It was a joyous day when I deleted my XML config files in favour of Java config. And even many of those got much smaller when I missed to Spring Boot.

24

u/gavenkoa Mar 24 '21

They provided first reference in 1.1:

https://docs.spring.io/spring-framework/docs/1.1.x/reference/

It is a good reading as they describe "magic". Now you just accept it, back then they have to justify and explain ))

It was a time when questions like "BeanFactory vs FactoryBean" were important.

44

u/ziano_x Mar 24 '21

wow! 17 years and still going strong. Kudos to the team for building such a fantastic framework. The solid core of Spring with their DI library and ergonomics of Spring Boot and Spring Cloud are some reasons why I keep going back to it.

8

u/[deleted] Mar 24 '21

They are still strong, since JavaEE/JakartaEE shot in their foot, especially in the transition from java 8 to java 9+, with all those packages renamed and creating more mess than before, plus not supporting themselves jlink

3

u/ziano_x Mar 24 '21

Struts as well.

1

u/henk53 Mar 28 '21

creating more mess than before,

Which alleged mess are you exactly referring to?

2

u/[deleted] Mar 28 '21

Javax,* to Jakarta.*?

1

u/henk53 Mar 28 '21

with all those packages renamed and creating more mess than before

So you were just repeating yourself in:

"with all those packages renamed and creating more mess than before"

There's no mess other than the packages being renamed?

2

u/[deleted] Mar 29 '21

And all those split dependencies required in each project, without mentioning that they aren't compatible with jlink, since they aren't java modules but automodules?

3

u/moxyte Mar 24 '21

It's funny it's so old because for some reason it has only recently become hip and cool to have Spring. Any longtimers have insight why that may be or am I just imagining things?

7

u/vladmihalceacom Mar 24 '21

Actually, it was hype in 2005-2007. I've been using it ever since and never looked back.

The number one advantage was that it greatly simplified testing. You could run your unit and integration tests from JUnit, no matter you were testing the DAO, Service, or Web layer.

Then, you had a powerful AOP mechanism that allowed you to intercept calls, add memorization, transaction routing, logging with ease.

You could also easily integrate Hibernate or any other data access technologies without needing to use a JTA transaction manager.

The documentation was very well written. The development team was very active and there have been many releases over the years.

All in all, it has been a pleasure to use it for 17 years now.

2

u/mc_hambone Mar 24 '21

Killing EJB (shivers) was its main use for me 😝

4

u/henk53 Mar 25 '21

Killing EJB (shivers) was its main use for me 😝

Because putting @Stateless on a POJO was so much work? :P

1

u/mc_hambone Mar 25 '21

Uhh EJB 2.x didn’t support annotations (pre-Java 5).

1

u/henk53 Mar 26 '21

But in the midst of the given timeframe (2005-2007) EJB 3 was released ;)

1

u/mc_hambone Mar 26 '21

Spring was a direct response to the shit-show that was EJB 2.x and came out 2 years before EJB 3.0, which was created to incorporate Spring concepts and ease of use.

I started my career pre-Spring during EJB’s hay day, so I have some experience with this 🥴

1

u/zvaavtre Mar 27 '21

This. The original EJB was a monster shit show.

1

u/henk53 Mar 27 '21

The annotation driven approach weren't a Spring concept, since Spring was at the time EJB 3.0 came out still pushing us towards moving more code into XML.

4

u/ziano_x Mar 24 '21

Spring was pretty mainstream in Java land even before Spring Boot and Spring Cloud arrived. These 2 projects ensured that Spring's relevance in the microservices and cloud space continues.

2

u/RunnyPlease Mar 25 '21

My first coding job using Spring framework was 2009. It was pretty hot shit back then. I think it’s regained popularity now for the same reason it was popular then. Ease of setup (especially dependency injection), legibility and backward compatibility. Pair that with the recent trend of migrating aging systems to the cloud and you’ve got a recipe for success.

16

u/maxxedev Mar 24 '21

Interesting background on Spring's naming history:

It was referred to as the "Interface21 framework", but that was not a name to inspire a community. [...] Suggestion: "Spring" -- association with nature; and the fact that Spring represented a fresh start after the "winter" of traditional J2EE. We recognized the simplicity and elegance of this name, and quickly agreed on it.

https://spring.io/blog/2006/11/09/spring-framework-the-origins-of-a-project-and-a-name

2

u/Fiskepudding Mar 25 '21

Oh, I never thought about the season Spring. I always thought about a metal spring. TIL

1

u/nutrecht Mar 26 '21

Well they have a green leaf as their logo... ;)

1

u/Apache_Sobaco Mar 26 '21

Fresh cutting edge 17 year old piece of technology

0

u/[deleted] Mar 24 '21

[deleted]

7

u/[deleted] Mar 24 '21

interfaces and impl classes for no gain

I don't think that has been dogma in years. It was necessary in the past because proxying concrete classes requires bytecode manipulation (to create the subclass to proxy calls), which has become mainstream now. Proxying using interfaces is much simpler, and has native support from the JVM.

Express and similar libraries would be a much better model.

That is how Java used to be a long time ago. Putting together libraries on a bare bones application server (Tomcat, Jetty, etc.).

But as enterprise software has gotten more complex, integrating a large number technologies (like databases, queues, security, etc), people turned to frameworks to simplify application configuration. In Java, that has lead two models: integrate on a common product (Spring) or integrate on a common platform (JavaEE).