Spring Tutorial – Spring Framework tutorial

Target Audience

This Spring tutorial is designed for Java programmers who need to understand the Spring framework and its application.

Prerequisites

Before proceeding with this Spring tutorial you should have a good understanding of the Java programming language.

This is 1 of 16 parts of tutorial series

💻 Awesome Tech Resources:
  • Looking for ⚒️ tech jobs? Go to our job portal.
  • Looking for tech events? Go to tech events 🗓️ Calendar.️

Introduction

Spring is an open source framework created to address the complexity of enterprise application development. One of the chief advantages of the Spring framework is its layered architecture, which allows you to be selective about which of its components you use while also providing a cohesive framework for J2EE application development . If you may also go through spring interview questions for interview question on Spring.

Features

  • Lightweight

    spring is lightweight when it comes to size and transparency. The basic version of spring framework is around 1MB. And the processing overhead is also very negligible.

  • Inversion of control (IOC)

    The basic concept of the Dependency Injection or Inversion of Control is that, programmer do not need to create the objects, instead just describe how it should be created. No need to directly connect your components and services together in program, instead just describe which services are needed by which components in a configuration file/xml file. The Spring IOC container is then responsible for binding it all up.
  • Aspect oriented (AOP)

    Spring supports Aspect oriented programming .
    Aspect oriented programming refers to the programming paradigm which isolates secondary or supporting functions from the main program’s business logic. AOP is a promising technology for separating crosscutting concerns, something usually hard to do in object-oriented programming. The application’s modularity is increased in that way and its maintenance becomes significantly easier.

  • Container

    Spring contains and manages the life cycle and configuration of application objects.
  • MVC Framework

    Spring comes with MVC web application framework, built on core Spring functionality. This framework is highly configurable via strategy interfaces, and accommodates multiple view technologies like JSP, Velocity, Tiles, iText, and POI. But other frameworks can be easily used instead of Spring MVC Framework.
  • Transaction Management

    Spring framework provides a generic abstraction layer for transaction management. This allowing the developer to add the pluggable transaction managers, and making it easy to demarcate transactions without dealing with low-level issues. Spring’s transaction support is not tied to J2EE environments and it can be also used in container less environments.
  • JDBC Exception Handling

    The JDBC abstraction layer of the Spring offers a meaningful exception hierarchy, which simplifies the error handling strategy. Integration with Hibernate, JDO, and iBATIS: Spring provides best Integration services with Hibernate, JDO and iBATIS

 Architecture

Spring is well-organized architecture consisting  of seven modules. Modules in the Spring framework are:

  • Spring AOP

    One of the key components of Spring is the AOP framework. AOP is used in Spring:

    • To provide declarative enterprise services, especially as a replacement for EJB declarative services. The most important such service is declarative transaction management, which builds on Spring’s transaction abstraction.
    • To allow users to implement custom aspects, complementing their use of OOP with AOP
  • Spring ORM

    The ORM package is related to the database access. It provides integration layers for popular object-relational mapping APIs, including JDO, Hibernate and iBatis.

  • Spring Web

    The Spring Web module is part of Spring?s web application development stack, which includes Spring MVC.

  • Spring DAO

    The DAO (Data Access Object) support in Spring is primarily for standardizing the data access work using the technologies like JDBC, Hibernate or JDO.

  • Spring Context

    This package builds on the beans package to add support for message sources and for the Observer design pattern, and the ability for application objects to obtain resources using a consistent API.

  • Spring Web MVC

    This is the Module which provides the MVC implementations for the web applications.

  • Spring Core

    The Core package is the most import component of the Spring Framework.
    This component provides the Dependency Injection features. The BeanFactory  provides a factory pattern which separates the dependencies like initialization, creation and access of the objects from your actual program logic.

Spring Framework Architecture

Spring tutorial


Spring Core tutorial

Spring MVC

Spring AOP

Spring Boot

Spring Rest

Spring Security

Spring JDBCTemplate

Spring Quartz Scheduler

That’s all about Spring tutorial.
In next post, we will see dependency injection(ioc) in spring.


import_contacts

You may also like:

Related Posts

  • 24 June

    No qualifying bean of type in Spring or Spring Boot

    In this post, we will see about an exception: No qualifying bean of type. Exceptions are least expected but you might get it while working with Spring. or Spring boot. Did you get this exception: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type? If yes, let’s see different reasons for it. 💻 Awesome Tech Resources: Looking for […]

  • 17 June

    Spring XML configuration example

    In this post, we will see how to create Spring hello world XML based configuration example. Here are simple steps to create Spring XML configuration example. 1. Create a simple java maven project. 2. Maven dependency put spring and cglib maven dependency in pom.xml. 💻 Awesome Tech Resources: Looking for ⚒️ tech jobs? Go to our […]

  • 15 June

    Injecting Prototype bean into a Singleton bean in Spring

    In this post, we will see how to inject prototype bean scope into Singleton Instance in Spring. This is one of the most asked Spring interview questions. Problem When you inject prototype bean to singleton bean, prototype bean still behave like a singleton bean. Let’s understand this with the help of example. 1. Create a […]

  • 15 June

    Circular dependencies in Spring

    In this post, we will discuss one of the most asked Spring interview questions. What happens if there are circular dependencies in Spring. Problem What if there are circular dependencies in Spring? For example: Class A requires an instance of Class B and Class B requires an instance of Class A. Let’s create an example […]

  • 12 September

    Spring init-method and destroy-method example

    In this post, we will see about Spring init-method and destroy-method. When bean is instantiated or destroyed , there are some operations you may need to perform, so you can use init-method and destroy-method to call this methods while bean is being created or destroyed. Lets understand it with the help of simple example: For […]

  • 27 July

    Prefix “context” for element “context:component-scan” or “context:annotation-config” is not bound : Spring error

    When you are working on spring or spring mvc application, you may encounter below error message. org.xml.sax.SAXParseException: The prefix “context” for element “context:component-scan” is not bound . or org.xml.sax.SAXParseException: The prefix “context” for element “context:annotation-config” is not bound . This issue generally occurs when you do not include context namespace. For example: Lets say you have below […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.