Spring framework was created as an alternative to the the complex J2EE specification and particular the usage of Enterprise Java Beans (EJB) that required fully fledged application server such as IBM WebSphere, WebLogic or JBoss. Although J2EE may fit the requirements for big enterprise level devolvement it was too complex and cumbersome for simple applications.
Please note that J2EE provided a full distributed system solution comprehending many like Enterprise Beans, Remote Method Invocation, Transaction managements, ORM, Servlet containers among others.
Spring came out as a lightweight middleware framework for java, based in simple beans (POJO) and relying heavily in the concept of Dependency Injection (DI), the implementation of an Application context that would manage the beans and thus enabling for Inversion of Control (IoC). And also very important Spring applications would run in as simple Servlet container like Tomcat.
At the time there already frameworks and technologies that compete with J2EE in regards to web development (Apache Struts), WebServices (Axis), ORM (Hibernate) to say a few, but the success of Spring came by positioning itself as the framework that couple different technologies and even provider solutions of its own as Spring MVC and JDBC Template.
The join venture of Spring MVC + Spring Core + Hibernate was a very popular solution to a three layer architecture and boosted the popularity of the framework.
In the following years Spring added more functionality and integration capabilities and delivers independent modules that can be added to extend functionality, some of the most popular ones up to date are:
- Spring MVC
- Spring Data JPA
- Spring Security
Curiously, EJB 3.0 specification end up coping much of the ideas brought by Spring but in a standardized fashion.
In the earlier years Spring relied in XML configuration, as the later was very popular at the time, with improvements in Java, Spring moved to a Java configuration using @Configuration and @Bean definitions.
The XML configuration was essential for the configuration of containers, Tomcat and others used an web.xml file for servlet configuration and Spring followed in having it’s bean configuration in such format.
There are still some examples of this type of configuration out there:
With the introduction of Java configuration the container itself started to be configured as an class (AbstractSecurityWebApplicationInitializer), example:
https://github.com/spring-petclinic/spring-framework-petclinic (without web.xml)
In recent years Spring moved to Component and stereotypes annotation and autoscan leaving Java configuration for third party integration or legacy application.
Additionally the tradition MVC workflow was replaced with API and service architecture more focused in microservices and external frontends.
As microservices became more popular, Spring offered a comprehensive set of technologies to address the challenges brought by this type of approach. Thus Spring Netflix/Spring cloud was delivered.
As containerization became more popular with Docker and Kubernetes and the configuration and dependency management of Spring applications became more complex, Spring Boot came as self-contained solution that enables auto configuration.
This made Spring more fitted for the more modern microservice architecture that relied much on containerization and restful services.