Hey everyone!!!

Did you already hear something about Spring to code applications? Such as me, did you feel confused at some moment with many "kind of springs"?

Here I'd like to show you a macro view of the Spring. I believe from the moment we can understand how all of these are connected it will be easier to choose what you will need to start your projects using Spring. So, let's go!!

Summary


An intuitive macro view

There are many Spring Projects and each one can have sub projects.  Amit Sharma in his post Spring Framework EcoSystem - Introduction of Spring Project splits the Spring Framework Ecosystem into five parts. Web layer, Common layer, Service layer, Data layer, Foundation.


Figure 1 - Reference: Spring Tutorials

Web Layer: It is related to front-end. The highlight is the Spring Security. Figure 1 doesn't show dependency but the web layer projects can make use of Spring Security. Spring Security is a framework that control who can interact with your application and at what levels; authentication and authorization, respectively.

Common Layer: The Spring Framework was created to teams can focus on application-level business logic. It gives support for examples: [1 - CORE] dependency injection (decoupling, management of scopes); [2 - TEST] tests; [3 - DATA ACCESS] transactions, DAO support, JDBC; [4 - Spring MVC], to create web applications and RESTful service and you can see a separation of responsibilities.


Figure 2 - MVC - Reference: Algawork


Service Layer: [1 - Spring Cloud] "Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems". [2 - Spring Integration] "Spring Integration’s primary goal is to provide a simple model for building enterprise integration solutions while maintaining the separation of concerns that is essential for producing maintainable, testable code."

Data Layer: This layer is related to data handling and manipulation. The highlights are Spring Data. The Spring Data give more facilities then the Spring Data Access in Spring Framework. This framework reduces the code by features such repository and custom object-mapping abstractions and dynamic query derivation from repository method names. Using Spring Data also is possible to swap the database with minimal code changes.  Spring AMQP is related to the use of messages in the systems and Spring Batch is used to makes the programmer's lives easier when they need to work with batch jobs. Spring LDAP can be used to guarantee the authorization.

Foundation Layer: Spring IO Platform provides facilities to use different projects or modules together (one platform, many workloads), but the supported life finishes on 9 April 2019. The Spring Boot makes the programmer more productive because it'll not necessary to be worried about configurations (no requirement for XML configuration; embed Tomcat, Jetty or Undertow directly). Spring XD is related to build and manage big data applications (Spring XD is redesigned as Spring Cloud Data Flow).


Figure 3 - Spring Boot: Reference - DevMedia


Spring Boot Starters

Dependency management is an important issue in the projects. To help the developer, Spring Boot and an automation tool such as Maven, can make the process easier. For that, the Spring Boot Staters were built, and that reduced the number of manually added dependencies just by adding one dependency in pom.xml.

One example is when you wish to build a WEB application. It's necessary only one dependency from Spring Boot. This Spring Boot declaration control other dependencies like Web, MVC, Tomcat. It allows the RESTfull implementation. It’s actually Spring MVC which provides all useful annotations to REST implementation.

Another example is to use test libraries. This Spring Boot declaration control other dependencies like mockito, junit, spring test.

The Spring Boot DevTool can help to control autoconfigure, jdb, hibernate core, servlet-api, sprint web. Two important features in DevTool is the automatic restart whenever files change in the classpath and permit a browser refresh when a resource is changed.

To use Spring Data you can use:

A complete example of pom.xml using Spring Boot you can see here.


Conclusion

Spring has a big ecosystem that can help your application in several aspects. With a macro view, you can focus on your necessities. Spring Data JPA, Spring Boot, Spring Security, Spring Framework are, certainly, the main concepts that you should have. They are very important to implement a trust application in an easy way.

Understand your requirements and go deep in your studies.!!!

Posts Related:

References