• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

Java Spring Tutorials

Java Spring Tutorials

Welcome to Java Spring Tutorials. Spring handles the infrastructure so you can focus on your application.The intent of these tutorials is to provide good understanding of Java Spring.

In addition to these tutorials, we will also cover common issues, Interview questions and How To’s of MongoDB.

Introduction

The Spring Framework is an application framework and inversion of control container for the Java platform. The framework’s core features can be used by any Java application, but there are extensions for building web applications on top of the Java EE platform.

Spring enables you to build applications from “plain old Java objects” (POJOs) and to apply enterprise services non-invasively to POJOs. This capability applies to the Java SE programming model and to full and partial Java EE.

Examples of how you, as an application developer, can benefit from the Spring platform:

-Make a Java method execute in a database transaction without having to deal with transaction APIs.

-Make a local Java method a remote procedure without having to deal with remote APIs.

-Make a local Java method a management operation without having to deal with JMX APIs.

-Make a local Java method a message handler without having to deal with JMS APIs.

Java Spring Modules

The Spring Framework consists of features organized into about 20 modules. These modules are grouped into Core Container, Data Access/Integration, Web, AOP (Aspect Oriented Programming), Instrumentation, Messaging, and Test, as shown in the following diagram.

 

Capture.1348

Spring Core Module

This Core Module is the base module of a spring framework application.

This Core Module will provide the following information to the spring programmers.

-The way of creating spring Beans.

-The way of Configuring Spring Beans.

-The way of injecting the dependencies.

-The way of obtaining a spring container object.

-The way of accessing the spring beans from container.

Spring DAO Module

 This Module will provide an abstraction layer on top of JDBC technology.

While working with JDBC technology directly as programmers, we are writing the Boilerplate code (Repeated code) like Loading the driver, opening a connection, creating a statement and closing the objects etc…

Apart from Boilerplate code, we also need to handle the Exceptions of JDBC explicitly because JDBC Exceptions are checked exceptions.

In order to avoid the Boilerplate code and to also avoid exception handling Burdon, spring framework has provided this DAO module.

Spring ORM Module

  This ORM Module is an abstraction layer on top of the ORM tools and which makes a spring programmer to transfer a data between application and database in the form of objects.

ORM tools are very good tools for communicating with databases but having some drawbacks, these drawbacks are eliminated in spring ORM module.

Spring AOP Module:

 Aspect Oriented Programming is a new way to developing real time applications with required services

The AOP module will provide us the way of separating the services from Business logic and also it provides us the way of injecting the services for business logic at runtime.

In spring terminology, the services are also called “Cross-Cutting Concerns” (Middleware services).

Spring JEE Module:

This Module is for implementing the middleware services required for Business logic. This spring JEE module is an abstraction layer on top of RMI, Javamail, JMS, Jars etc…

There is a difference between AOP and JEE modulesAOP is just for applying the services (or) injecting the services but not for implementing the services, whereas JEE is a module for implementing the services.For real time Business logic development with middleware services, we use spring core, spring AOP, and spring JEE modules.

Spring Web Module:

   This module is either for integrating with web applications created in other frame works (or) for creating complete MVC to based web application in spring framework.

Spring web module is also called Spring web MVC module and this module is for creating web applications of java with MVC to architecture.

Spring container

A Spring container is the heart of Spring framework. It takes care of objects (referred to as ‘beans’ in the Spring universe) from cradle to grave. The container manages the beans that form a part of the complete application. Spring container achieves Inversion of Control by injecting dependencies into the beans as per the configuration.

Spring container can be thought as “a bucket of beans“, where the pre-configured beans are pooled.

As far as the creation and destruction of beans is concerned, Spring container has following responsibilities:

-Creation and initialization of beans

-Wiring them together

-Managing bean scopes

-Handle the complete bean lifecycle till its destruction

These core tutorials will help you to learn 
the fundamentals of Java Spring.
For an in-depth understanding and practical experience, 
explore Online Java Spring Training.

The container reads the configuration metadata supplied to it and then uses this metadata to instantiate, configure and assemble the beans in application. Configuration metadata can be provided in any of the 3 format:

-XML based configuration metadata

-Annotation based configuration (introduced with Spring 2.5)

-Java based configuration (introduced with Spring 3.0)

The Spring IoC container itself is totally decoupled from the format in which this configuration metadata is actually provided to the application.

 

Capture.1349

Containers are objects that hold a number of bean definitions, each uniquely identified by a String name. Depending on the bean definition, the factory will return either an independent instance of a contained object (the Prototype design pattern), or a single shared instance.

Benefits of Using Spring

-Spring enables developers to develop enterprise-class applications using POJOs. The benefit of using only POJOs is that you do not need an EJB container product such as an application server but you have the option of using only a robust servlet container such as Tomcat or some commercial product.

-Spring is organized in a modular fashion. Even though the number of packages and classes are substantial, you have to worry only about ones you need and ignore the rest.

-Spring does not reinvent the wheel instead, it truly makes use of some of the existing technologies like several ORM frameworks, logging frameworks, JEE, Quartz and JDK timers, other view technologies.

-Testing an application written with Spring is simple because environment-dependent code is moved into this framework. Furthermore, by using JavaBean-style POJOs, it becomes easier to use dependency injection for injecting test data.

-Spring’s web framework is a well-designed web MVC framework, which provides a great alternative to web frameworks such as Struts or other over engineered or less popular web frameworks.

-Spring provides a convenient API to translate technology-specific exceptions (thrown by JDBC, Hibernate, or JDO, for example) into consistent, unchecked exceptions.

-Lightweight IoC containers tend to be lightweight, especially when compared to EJB containers, for example. This is beneficial for developing and deploying applications on computers with limited memory and CPU resources.

-Spring provides a consistent transaction management interface that can scale down to a local transaction (using a single database, for example) and scale up to global transactions (using JTA, for example).

Related Trainings

Contact US

Need an Instructor Led Training, Contact Us





Enter this code: captcha