Skip to content

Spring Framework Overview

Why Spring?#

Spring In A NullShell#

  • Spring is a very popular framework for building enterprise Java applications.
  • Initial a simpler and lightweight alternative to J2EE.
  • Provides a large number of helper classes and make thing easier.
  • So for the reason why Spring we can say it simplifies Java Enterprise Development.

What Is The J2EE?#

  • The Java EE stands for Java Enterprise Edition, which was earlier known as J2EE and is currently known as Jakarta EE. It is a set of specifications wrapping around Java SE (Standard Edition). The Java EE provides a platform for developers with enterprise features such as distributed computing and web services. Java EE applications are usually run on reference run times such as microservers or application servers. Examples of some contexts where Java EE is used are e-commerce, accounting, banking information systems.
  • Below is the 4 types of J2EE modules.

 #zoom

What Is The Java SE?#

  • The SE stands for Java Standard Edition is a computing platform in which we can execute software, and it can be used for development and deployment of portable code for desktop and server environments. It has the Java programming language in use. It is part of Java software-platform family. Java SE has a variety of general purpose APIs and the Java Class Library. It is the core Java programming platform and provides all the libraries and APIs such as java.lang, java.io, java.math, java.net, java.util etc.

Java EE History#

  • Let's see the history of J2EE as in image below.

 #zoom

EJB Complexity#

  • Early version of EJB V1 and V2 were extremely complex
  • Multiple deployment descriptors
  • Multiple interfaces
  • Poor performance of Entity Beans

J2EE Without EJB#

  • Rod Johnson is the founder of Spring who wrote 2 books.
    • J2EE development without EJB, Wrox Press
    • Java Development with the Spring Framework, Worx Press

Release Timeline#

  • The JEE and Spring release timeline is showed as in the picture below.

 #zoom

Spring Demand#

  • Most of Java works today requires employee knows using Spring Framework and it will be an addition point for you in interviews.

Spring 5#

Spring 5 Release#

  • In September 2017, Spring 5 was released.

 #zoom

Spring 5 Main Features#

  • Update minimum requirements for Java 8 or higher
  • Deprecated legacy integration for Tiles, Velocity, Portlet, Guava etc.
  • Upgraded Spring MVC to use new version of Servlet Api 4.0
  • Added new reactive programming framework: Spring WebFlux

Spring Core Framework#

Goals Of Spring#

  • Lightweight development with Java POJOs (Plain Old Java Objects)
  • Dependency injection to promote loose coupling
  • Declarative programming with Aspect-Oriented-Programming (AOP)
  • Minimize boilerplate Java code.

Core Container#

 #zoom

  • Core container is the main item of Spring, it manages how beans are created, it has a bean factory for creating the beans and manage bean dependencies. It also can read config files for setting properties and dependencies.
  • The context is the spring container that holds the beans in memory.
  • The SpEL is the Spring Expression Language that we can use within the config files to refer to other beans.

Infrasturcture#

 #zoom

  • AOP (Aspect Oriented Programming), it allows you to create application-wide services like logging, security, transactions, instrumentation and then you can apply these services to your objects in a declarative fashion. You don't need to modify your code to have support for this, just need to add config file or annotation.
  • The instrumentation module is used for creating Java agents to remotely monitor our app with JMX (Java Management Extension).

Data Access Layer#

 #zoom

  • This is used for communicating with database either a relational database or a NoSQL database and also making use of like a message queue.
  • On the top we have JDBC helper classes which will reduce your JDBC code by 50%.
  • Next we have ORM (Object to Relation Mapping) module which allows us to hook into Hibernate or JPA
  • JMS (Java Message Service) which allows us to send aynchronous messages to a Message Broker. This module provides helper classes for us to make use of the Java Message Service and we can reduce our code by over 50%.
  • Transactions module is used for transaction support. Spring provides a transaction manager that we can make use of transactions on methods, on database calls and pretty much anything we want.

Web Layer#

 #zoom

  • The Web Layer contains all web related classes, it is the home of Spring MVC framework.

Test Layer#

 #zoom

  • Spring has supported for test-driven development, so the framework includes mock objects for mocking out servlet, JNDI access and so on and we can do all of this outside of the container.
  • We can also make use of integration tests by creating an application context and wiring up our desired objects.

Spring Projects#

What Are Spring Projects?#

  • Spring Projects are additional Spring modules built-on top of the core Spring Framework.
  • Some Spring projects:

  • You can view more in this page

References#