
Spring is development framework for Java programming. It is an open source development framework for Enterprise Java.
The core features of Spring Framework can be used in developing a Java Enterprise application.
It has many extensions and jars for developing web applications on top of Java EE platform.
With Spring we can develop large-scale complex Java applications very easily. It is also based on good design patterns like Dependency Injection, Aspect oriented programming for developing extensible feature rich software.
Spring framework has a Core Container. Modules in Core Container are:
Core module
Bean module
Context module
Spring Expression Language module
Modules in Data Access/Integration Layer of Spring framework are:
JDBC module: An abstraction layer to remove tedious JDBC coding.
ORM module Integration layers for Object Relational Mapping
OXM module: An abstraction layer to support Object XML mapping.
Java Messaging Service (JMS) module: Module for producing and consuming messages.
Transactions module: Transaction Management for POJO classes
Modules in Web Layer of Spring framework are:
As the name suggests, Spring Core Container is the core of Spring framework. It gives the basic functionality of the Spring. All the parts of Spring Framework are built on top of Core Container.
Its main use is to provide Dependency Injection (DI) and Inversion of control (IOC) features.
Spring Test Module provides support for Unit testing as well as Integration testing of Spring components. It allows using JUnit or TestNG testing frameworks. It also gives ability to mock objects to use the test code.
AOP module is also known as Aspect Oriented Programming module. Its uses are:
Development of aspects in a Spring based application
Provides interoperability between Spring and other AOP frameworks
Supports metadata programming to Spring
Spring provides JDBC abstraction layer module. Main benefits of this module are:
Spring-webmvc module is also known as Web-servlet module. It is based on Web Model View Controller pattern.
Main uses of this module are:
Inversion of Control (IOC) principle is the base of Spring framework. It supports dependency injection in an application. With Dependency Injection, a programmer has to write minimal code. It also makes easier to test an application.
Most important benefit is that it leads to loose coupling within objects. With loose coupling it is easier to change the application with new requirements.
IOC Container in Spring supports both the approaches. Eager instantiation as well as lazy loading of beans.
ApplicationContext in Spring provides following benefits:
ApplicationContext in Spring can be implemented in one of the following three ways:
FileSystemXmlApplicationContext: If we want to load the definitions of beans from an XML file then FileSystemXmlApplicationContext is used. The full path of XML bean configuration file is provided to the constructor.
ClassPathXmlApplicationContext: To loads the definitions of beans from an XML file in the CLASSPATH, we use ClassPathXmlApplicationContext. It is used for application context embedded in jars.
WebXmlApplicationContext: To provide configuration for a web application WebXmlApplicationContext is used. While the application is running, it is read only. But it can be reloaded if underlying application supports it.
In a Spring based application, main components are:
Dependency Injection (DI) pattern has following disadvantages:
Spring supports three ways to provide configuration metadata to Spring Container:
In configuration xml, we can specify the scope of bean in its definition. This is used by container to decide the scope of bean in Spring.
E.g. <bean id="userService" class="com.um.UserService" scope="prototype"/>
This is an example of userService bean with prototype scope.
No, Spring framework does not guarantee anything related to multi-threaded behavior of a singleton bean. Developer is responsible for dealing with concurrency issues and maintaining thread safety of a singleton bean.
A Spring container is responsible for injecting dependencies between beans. This process of connecting beans is called wiring.
Developer mentions in configuration file, the dependencies between beans. And Spring container reads these dependencies and wires the beans on creation.
Autowiring is a great feature in Spring. It can be used in most of the cases. But there are certain scenarios in which Autowiring may not work.
Explicit wiring: Since Autowiring is done by Spring, developer does not have full control on specifying the exact class to be used. It is preferable to use Explicit wiring in case of full control over wiring.
Primitive Data types: Autowiring does not allow wiring of properties that are based on primitive data types like- int, float etc.
Yes, Spring allows injecting null or empty String values.
Some of the benefits of using Spring DAO are:
It makes it easier to work on different data access methods like- JDBC, Hibernate etc.
It provides a consistent and common way to deal with different data access methods.
Spring DAO makes it easier to switch between different data persistence frameworks.
No need for catching framework specific exceptions.
Spring provides two ways to use Hibernate:
We can extend HibernateDAOSupport and apply an AOP interceptor node to use Hibernate.
We can also use HibernateTemplate and Callback to access Hibernate. This is based on Inversion of Control.
Spring supports following Object Relational Mapping (ORM) frameworks:
We can use following steps for integrating Spring and Hibernate:
In Spring AOP, Joinpoint refers to a candidate point in application where we can plug in an Aspect.
Joinpoint can be a method or an exception or a field getting modified.
This is the place where the code of an Aspect is inserted to add new behavior in the existing execution flow.
An Advice in Spring AOP, is an object containing the actual action that an Aspect introduces.
An Advice is the code of cross cutting concern that gets executed.
There are multiple types of Advice in Spring AOP.
Spring AOP provides five kinds of Advice:
In Spring AOP, a Proxy is an object created by the AOP framework to implement Aspect contracts. It is generally a JDK dynamic proxy or CGLIB proxy.
Spring AOP provides following standard types of Autoproxy creators:
Spring is one of the most popular software framework for enterprise applications implemented in Java. Big companies like Amazon, Netflix, Google etc use Spring Framework in their Software development architecture. This course is designed to help you achieve your goals in Spring Framework field. Software Engineers with Spring Framework knowledge may get more salary than others with similar qualifications without Spring Framework knowledge.
In this course, you will learn how to handle interview questions on Spring Framework in Software Design and Development. I will explain you the important concepts of Spring Framework.
You will also learn the benefits and use cases of Spring Framework in this course.
What is the biggest benefit of this course to me?
Finally, the biggest benefit of this course is that you will be able to demand higher salary in your next job interview.
It is good to learn Spring Framework for theoretical benefits. But if you do not know how to handle interview questions on Spring Framework, you can not convert your Spring Framework knowledge into higher salary.
What are the topics covered in this course?
We cover a wide range of topics in this course. We have questions on Spring Framework best practices, Security. tricky questions etc.
How will this course help me?
By attending this course, you do not have to spend time searching the Internet for Spring Framework interview questions. We have already compiled the list of the most popular and the latest Spring Framework Interview questions.
Are there answers in this course?
Yes, in this course each question is followed by an answer. So you can save time in interview preparation.
What is the best way of viewing this course?
You have to just watch the course from beginning to end. Once you go through all the videos, try to answer the questions in your own words. Also mark the questions that you could not answer by yourself. Then, in second pass go through only the difficult questions. After going through this course 2-3 times, you will be well prepared to face a technical interview in Spring Framework.
What is the level of questions in this course?
This course contains questions that are good for a Fresher to an Architect level. The difficulty level of question varies in the course from a Fresher to an Experienced professional.
What happens if Spring Framework technology changes in future?
From time to time, we keep adding more questions to this course. Our aim is to keep you always updated with the latest interview questions on Spring Framework.
What are the sample questions covered in this course?
Sample questions covered in this course are as follows: