Welcome to Java Spring Tutorials. Spring handles the infrastructure so you can focus on your application. The intent of these tutorials is to provide a 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 to Java Spring
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.
To enrich your career and become a Java Spring professional, visit Tekslate, the global online training platform:" Java Spring Training". This course will help you achieve excellence in this field.
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.
Spring Core Module
This Core Module is the base module of a spring framework application.
-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 the container.
Spring DAO Module
This Module will provide an abstraction layer on top of JDBC technology.
Spring ORM Module
This ORM Module is an abstraction layer on top of the ORM tools and which makes a spring programmer transfer data between application and database in the form of objects.
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 frameworks (or) for creating complete MVC to the based web applications in the spring framework.
Spring web module is also called the Spring web MVC module and this module is for creating web applications of java with MVC to architecture.
Learn More: Java Spring Interview Questions and Answers
-Creation and initialization of beans
-Wiring them together
-Managing bean scopes
-Handle the complete bean lifecycle until its destruction
The container reads the configuration metadata supplied to it and then uses this metadata to instantiate, configure and assemble the beans in the application. Configuration metadata can be provided in any of the 3 formats:
-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.
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 is substantial, you have to worry only about the 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).