Spring Framework Certification Training

[vc_row][vc_column][vc_column_text]

Spring Framework Certification Training course is designed to make you an expert in using Spring Framework and learn all that is required to create real world web applications with Spring.

[/vc_column_text][/vc_column][/vc_row][vc_row full_width=”stretch_row” css=”.vc_custom_1559286923229{background-color: #f6f6f7 !important;}”][vc_column width=”1/2″][vc_tta_accordion color=”peacoc” active_section=”1″][vc_tta_section title=”Introduction to Spring” tab_id=”1559286383409-ab730398-6c03″][vc_column_text]Learning Objectives – In this module, you will understand what Spring Framework is and why it is so popular. You will learn Spring Framework architecture and features it offers to developers. What are Inversion of Control (IOC) and famous Dependency Injection? Controlling a bean life cycle.

Topics – Introduction to Spring Framework, Why Spring, Java Frameworks, Spring Framework architecture, Object Coupling Problem, Loose coupling and Tight coupling, Dependency Injection and its types, Bean Life cycle, Bean scopes (singleton and prototype), Annie’s Quizzes, LAB, Q & A, Quick Recap.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Spring Configurations” tab_id=”1559286522681-3bf94e12-e7b7″][vc_column_text]Learning Objectives –  In this module, you will learn about different ways of configuring the beans in Spring. In addition you will learn about the configuration mechanisms and the Application Programming Interfaces (APIs) provided by Spring for configuration using simple examples.  You will learn to write expressions using various features provided by SpEL and using them to access the beans. You will also learn the core SpEL API that is in use in Spring applications.

Topics –  What is Autowiring, Different types of autowiring, Implementing autowiring in different ways, Spring bean definition inheritance, Specifying default values using @value annotation, Autowiring bean using @Autowired, Resolving bean using @Qualifier, Defining a component using @Component, Using @PostConstruct and @PreDestroy, Automatic Bean discovery in a Spring application, Using Spring Expression Language(SpEL), Annie’s Quizzes, LAB, Q & A, Quick Recap.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Aspect Oriented Programming and DAO” tab_id=”1561382593569-b1979b66-b066″][vc_column_text]Learning Objectives – In this module, you will learn about the limitations of using OOPs and the need for Aspect Oriented Programming (AOP). Next, you will learn about the core functionalities of AOP and the problems it solves. You also use AOP with Spring framework.This module will introduce Spring framework support for using JDBC and discusses all the classes and interfaces provided by it.

Topics –  What is Aspect Oriented Programming (AOP),AOP terminologies, Implementing MethodBeforeAdvice, Implementing AfterReturningAdvice, Implementing MethodInterceptor, Implementing ThrowsAdvice, What is AspectJ, AspectJ provided annotations like @Aspect,@Before etc., Data Access Object (DAO)pattern, Using property files, Annie’s Quizzes, LAB, Q & A, Quick Recap.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Data Access” tab_id=”1561382595833-dd54d407-26c0″][vc_column_text]Learning Objectives – In this module, we will learn the use of template classes and methods for JDBC operations with the help of examples.  You will also learn about exception handling and executing stored procedures. We will develop a Spring application using the JDBC APIs. We will discuss the need of ORM framework and their advantages. We will look simple examples while discussing the Spring API for ORM. We will also discuss the use of transactions with frameworks using the Spring framework.

Topics – Using Jdbc Template, Binding variables in database query, Mapping database rows to Java class, Jdbc Batch Processing, What is Hibernate, Working With Hibernate, Integrating Hibernate with Spring, Database Transaction, Spring support for Database transactions, Annie’s Quizzes, LAB, Q & A, Quick Recap.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are the major features in different versions of Spring Framework?” tab_id=”1584629291601-2b435fef-7125″][vc_column_text]

Features of Spring Framework

Version Logo Feature
Spring 2.5 spring 2.5 logo - Spring Interview Questions - Edureka! This version was released in 2007. It was the first version which supported annotations.
Spring 3.0 spring 3.0 logo - Spring Interview Questions - Edureka! This version was released in 2009. It made full-fledged use of improvements in Java5 and also provided support to JEE6.
Spring 4.0 Spring 4.0 logo - Spring Interview Questions - Edureka!  This version was released in 2013. This was the first version to provide full support to Java 8.

[/vc_column_text][/vc_tta_section][vc_tta_section title=” What is a Spring Framework?” tab_id=”1584629292297-69182968-beb8″][vc_column_text]

  • Spring is a powerful open source, application framework created to reduce the complexity of enterprise application development.
  • It is light-weighted and loosely coupled.
  • It has layered architecture, which allows you to select the components to use, while also providing a cohesive framework for J2EE application development.
  • Spring framework is also called the framework of frameworks as it provides support to various other frameworks such as Struts, Hibernate, Tapestry, EJB, JSF etc.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”List the advantages of Spring Framework.” tab_id=”1584629292897-421b3132-fe71″][vc_column_text]

  • Because of Spring Frameworks layered architecture, you can use what you need and leave which you don’t.
  • Spring Framework enables POJO (Plain Old Java Object) Programming which in turn enables continuous integration and testability.
  • JDBC is simplified due to Dependency Injection and Inversion of Control.
  • It is open-source and has no vendor lock-in.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are the different features of Spring Framework?” tab_id=”1584629293655-c026fa47-d33a”][vc_column_text]Following are some of the major features of Spring Framework :

  • Lightweight: Spring is lightweight when it comes to size and transparency.
  • Inversion of control (IOC): The objects give their dependencies instead of creating or looking for dependent objects. This is called Inversion Of Control.
  • Aspect oriented Programming (AOP): Aspect oriented programming in Spring supports cohesive development by separating application business logic from system services.
  • Container: Spring Framework creates and manages the life cycle and configuration of the application objects.
  • MVC Framework: Spring Framework’s MVC web application framework is highly configurable. Other frameworks can also be used easily instead of Spring MVC Framework.
  • Transaction Management: Generic abstraction layer for transaction management is provided by the Spring Framework. Spring’s transaction support can be also used in container less environments.
  • JDBC Exception Handling: The JDBC abstraction layer of the Spring offers an exception hierarchy, which simplifies the error handling strategy.

[/vc_column_text][/vc_tta_section][vc_tta_section title=” How many modules are there in Spring Framework and what are they?” tab_id=”1584629294279-53733c61-c0e7″][vc_column_text]There are around 20 modules which are generalized into Core Container, Data Access/Integration, Web, AOP (Aspect Oriented Programming), Instrumentation and Test.

  • Spring Core Container – This layer is basically the core of Spring Framework. It contains the following modules :
  1. Spring Core
  2. Spring Bean
  3. SpEL (Spring Expression Language)
  4. Spring Context
  • Data Access/Integration – This layer provides support to interact with the database. It contains the following modules :
  1. JDBC (Java DataBase Connectivity)
  2. ORM (Object Relational Mapping)
  3. OXM (Object XML Mappers)
  4. JMS (Java Messaging Service)
  5. Transaction
  • Web – This layer provides support to create web application. It contains the following modules :
  1. Web
  2. Web – MVC
  3. Web – Socket
  4. Web – Portlet
  • Aspect Oriented Programming (AOP) – In this layer you can use Advices, Pointcuts etc., to decouple the code.
  • Instrumentation – This layer provides support to class instrumentation and classloader implementations.
  • Test – This layer provides support to testing with JUnit and TestNG.

Few Miscellaneous modules are given below:

  • Messaging – This module provides support for STOMP. It also supports an annotation programming model that is used for routing and processing STOMP messages from WebSocket clients.
  • Aspects – This module provides support to integration with AspectJ.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is a Spring configuration file?” tab_id=”1584629295016-44895d77-a4d0″][vc_column_text]A Spring configuration file is an XML file. This file mainly contains the classes information. It describes how those classes are configured as well as introduced to each other. The XML configuration files, however, are verbose and more clean. If it’s not planned and written correctly, it becomes very difficult to manage in big projects.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are the different components of a Spring application?” tab_id=”1584629295736-17827577-fd83″][vc_column_text]A Spring application, generally consists of following components:

  • Interface: It defines the functions.
  • Bean class: It contains properties, its setter and getter methods, functions etc.
  • Spring Aspect Oriented Programming (AOP): Provides the functionality of cross-cutting concerns.
  • Bean Configuration File: Contains the information of classes and how to configure them.
  • User program: It uses the function.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are the various ways of using Spring Framework?” tab_id=”1584629296434-6221a1e4-9e3f”][vc_column_text]Spring Framework can be used in various ways. They are listed as follows:

  1.  As a Full-fledged Spring web application.
  2. As a third-party web framework, using Spring Frameworks middle-tier.
  3.  For remote usage.
  4. As Enterprise Java Bean which can wrap existing POJOs (Plain Old Java Objects).

The next section of Spring Interview Questions is on Dependency Injection and IoC container.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is Spring IOC Container?” tab_id=”1584629297142-4ae98f3c-e6f6″][vc_column_text]At the core of the Spring Framework, lies the Spring container. The container creates the object, wires them together, configures them and manages their complete life cycle. The Spring container makes use of Dependency Injection to manage the components that make up an application. The container receives instructions for which objects to instantiate, configure, and assemble by reading the configuration metadata provided. This metadata can be provided either by XML, Java annotations or Java code.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What do you mean by Dependency Injection? ” tab_id=”1584629297815-3c113de7-4e3e”][vc_column_text]In Dependency Injection, you do not have to create your objects but have to describe how they should be created. You don’t connect your components and services together in the code directly, but describe which services are needed by which components in the configuration file. The IoC container will wire them up together.[/vc_column_text][/vc_tta_section][vc_tta_section title=”In how many ways can Dependency Injection be done?” tab_id=”1584629299214-9a1d29eb-6664″][vc_column_text]In general, dependency injection can be done in three ways, namely :

  • Constructor Injection
  • Setter Injection
  • Interface Injection

In Spring Framework, only constructor and setter injections are used.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Differentiate between constructor injection and setter injection.” tab_id=”1584629299840-d54785d3-345f”][vc_column_text]

Constructor Injection vs Setter Injection

Constructor Injection Setter Injection
There is no partial injection. There can be partial injection.
It doesn’t override the setter property. It overrides the constructor property.
It will create a new instance if any modification is done. It will not create new instance if any modification is done.
It works better for many properties. It works better for few properties.

[/vc_column_text][/vc_tta_section][/vc_tta_accordion][/vc_column][vc_column width=”1/2″][vc_tta_accordion color=”peacoc” active_section=”1″][vc_tta_section title=”Spring Web” tab_id=”1561382561432-7f73ef2a-cc67″][vc_column_text]Learning Objectives – We will discuss the need of MVC pattern for web developers. We will discuss the spring MVC architecture and API. You also learn how to develop few applications using Spring MVC.  We will use Java Server Pages as the view component and we will discuss using them in Spring MVC applications.  As alternatives to JSP, we will take a look on Tiles framework to define a master layout for web applications.

Topics – Spring MVC Architecture,  MVC Components,  Setup Spring MVC Application,  Writing a Spring MVC application,  Exception Handling,  Apache Tiles.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Integrating Struts 2, JSF with Spring, Spring Web Flow” tab_id=”1561382561455-654071d3-eb53″][vc_column_text]Learning Objectives – In this module, we will start with introduction to Struts 2.x and JSF technologies.  We will see how Strut 2.x applications configure to use Spring easily.  We will see how JSF resolver resolves the value binding expressions used for performing a look up in the Spring configuration files.  We will discuss details of mechanisms of using Spring with JSF and Struts applications.  We will also understand how Spring Web Flow is motivated and how Spring Web Flow works.

Topics – Understand Struts 2 and JSF,  Integration Spring with Struts, Developing a Struts 2 application, Integrating JSF with Spring, Developing a JSF application,  Spring Web Flow.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Spring Security” tab_id=”1561382611424-56181e07-6453″][vc_column_text]Learning Objectives  – In this module, we will learn how to integrate Spring Security with a Spring MVC web application to secure a URL access. Also learn how to limit login attempts in Spring Security, how to implement “Remember Me” login features, storing a  hash a password and perform a login authentication.  We will also see adding Log4j for Logging and writing test cases with JUnit.

Topics – Spring features for Securing applications, Implementing Remember me  feature, Storing Encrypted Passwords, Restricting the number of login attempts, Logging with Log4j, Writing test cases with JUnit.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Spring Integration” tab_id=”1561382613753-7c9c9136-4ca1″][vc_column_text]Learning Objectives – In this module, we look into Enterprise Integration from a general standpoint. How Spring Integration enables lightweight messaging within Spring-based applications and supports integration with external systems via declarative adapters. We discuss the problem space that Spring Integration Framework is addressing and the introduction to the basic building blocks of the framework—the messages, channels, and endpoints. You will understand how Spring Integration Framework is a perfect fit for any Enterprise or standalone messaging application and how to start working on real world projects.

Topics – Introduction to messages, channels, and Endpoints, Receiving Messages, Common Endpoints, Endpoint API, Message Flow components, Introduction to Adapters.[/vc_column_text][/vc_tta_section][vc_tta_section title=” How many types of IOC containers are there in spring?” tab_id=”1584629300968-391f3fb9-976b”][vc_column_text]

  1. BeanFactory: BeanFactory is like a factory class that contains a collection of beans. It instantiates the bean whenever asked for by clients.
  2. ApplicationContext: The ApplicationContext interface is built on top of the BeanFactory interface. It provides some extra functionality on top BeanFactory.

[/vc_column_text][/vc_tta_section][vc_tta_section title=” Differentiate between BeanFactory and ApplicationContext.” tab_id=”1584629620140-80639674-4102″][vc_column_text]

BeanFactory vs ApplicationContext

BeanFactory ApplicationContext
It is an interface defined in org.springframework.beans.factory.BeanFactory It is an interface defined in org.springframework.context.ApplicationContext
It uses Lazy initialization It uses Eager/ Aggressive initialization
It explicitly provides a resource object using the syntax It creates and manages resource objects on its own
It doesn’t supports internationalization It supports internationalization
It doesn’t supports annotation based dependency It supports annotation based dependency

[/vc_column_text][/vc_tta_section][vc_tta_section title=” List some of the benefits of IoC.” tab_id=”1584629301543-879a633e-80c4″][vc_column_text]Some of the benefits of IoC are:

  • It will minimize the amount of code in your application.
  • It will make your application easy to test because it doesn’t require any singletons or JNDI lookup mechanisms in your unit test cases.
  • It promotes loose coupling with minimal effort and least intrusive mechanism.
  • It supports eager instantiation and lazy loading of the services.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Explain Spring Beans?” tab_id=”1584629302158-0d5c8bc8-66aa”][vc_column_text]

  • They are the objects that form the backbone of the user’s application.
  • Beans are managed by the Spring IoC container.
  • They are instantiated, configured, wired and managed by a Spring IoC container
  • Beans are created with the configuration metadata that the users supply to the container.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”How configuration metadata is provided to the Spring container?” tab_id=”1584629303013-f2ba2542-bdab”][vc_column_text]Configuration metadata can be provided to Spring container in following ways:

  • XML-Based configuration: In Spring Framework, the dependencies and the services needed by beans are specified in configuration files which are in XML format. These configuration files usually contain a lot of bean definitions and application specific configuration options. They generally start with a bean tag. For example:
1
2
3
<bean id="studentbean" class="org.edureka.firstSpring.StudentBean">
 <property name="name" value="Edureka"></property>
</bean>
  • Annotation-Based configuration: Instead of using XML to describe a bean wiring, you can configure the bean into the component class itself by using annotations on the relevant class, method, or field declaration. By default, annotation wiring is not turned on in the Spring container. So, you need to enable it in your Spring configuration file before using it. For example:
1
2
3
4
<beans>
<context:annotation-config/>
<!-- bean definitions go here -->
</beans>
  • Java-based configuration: The key features in Spring Framework’s new Java-configuration support are @Configuration annotated classes and @Bean annotated methods.

 

1. @Bean annotation plays the same role as the <bean/> element. 

 

 

 2.@Configuration classes allows to define inter-bean dependencies by simply calling other @Bean methods in the same class. 

For example:

1
2
3
4
5
6
7
@Configuration
public class StudentConfig
{
@Bean
public StudentBean myStudent()
{ return new StudentBean(); }
}

[/vc_column_text][/vc_tta_section][vc_tta_section title=”How many bean scopes are supported by Spring?” tab_id=”1584629304320-1496c9b4-4186″][vc_column_text]The Spring Framework supports five scopes. They are:

  • Singleton: This provides scope for the bean definition to single instance per Spring IoC container.
  • Prototype: This provides scope for a single bean definition to have any number of object instances.
  • Request: This provides scope for a bean definition to an HTTP-request.
  • Session: This provides scope for a bean definition to an HTTP-session.
  • Global-session: This provides scope for a bean definition to an Global HTTP-session.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the Bean life cycle in Spring Bean Factory Container?” tab_id=”1584629304896-7d6dd3c0-596a”][vc_column_text]Bean life cycle in Spring Bean Factory Container is as follows:

  1. The Spring container instantiates the bean from the bean’s definition in the XML file.
  2. Spring populates all of the properties using the dependency injection, as specified in the bean definition.
  3. The factory calls setBeanName() by passing the bean’s ID, if the bean implements the BeanNameAware interface.
  4. The factory calls setBeanFactory() by passing an instance of itself, if the bean implements the BeanFactoryAware interface.
  5. preProcessBeforeInitialization() methods are called if there are any BeanPostProcessors associated with the bean.
  6. If an init-method is specified for the bean, then it will be called.
  7. Finally, postProcessAfterInitialization() methods will be called if there are any BeanPostProcessors associated with the bean.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Explain inner beans in Spring.” tab_id=”1584629305965-619fd75d-f92e”][vc_column_text]A bean can be declared as an inner bean only when it is used as a property of another bean. For defining a bean, the Spring’s XML based configuration metadata provides the use of <bean> element inside the <property> or <constructor-arg>. Inner beans are always anonymous and they are always scoped as prototypes. For example, let’s say we have one Student class having reference of Person class. Here we will be creating only one instance of Person class and use it inside Student.

Here’s a Student class followed by bean configuration file:

Student.java

1
2
3
4
5
6
7
8
9
10
11
public class Student
{
private Person person;
//Setters and Getters
}
public class Person
{
private String name;
private String address;
//Setters and Getters
}

studentbean.xml

1
2
3
4
5
6
7
8
9
<bean id=“StudentBean" class="com.edureka.Student">
<property name="person">
<!--This is inner bean -->
<bean class="com.edureka.Person">
<property name="name" value=“Scott"></property>
<property name="address" value=“Bangalore"></property>
</bean>
</property>
</bean>

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Define Bean Wiring.” tab_id=”1584629307533-6979c655-3f17″][vc_column_text]When beans are combined together within the Spring container, it’s called wiring or bean wiring. The Spring container needs to know what beans are needed and how the container should use dependency injection to tie the beans together, while wiring beans.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What do you understand by auto wiring and name the different modes of it?” tab_id=”1584629308486-46c87fa3-7000″][vc_column_text]The Spring container is able to autowire relationships between the collaborating beans. That is, it is possible to let Spring resolve collaborators for your bean automatically by inspecting the contents of the BeanFactory.
Different modes of bean auto-wiring are:

  1. no: This is default setting which means no autowiring. Explicit bean reference should be used for wiring.
  2. byName: It injects the object dependency according to name of the bean. It matches and wires its properties with the beans defined by the same names in the XML file.
  3. byType: It injects the object dependency according to type. It matches and wires a property if its type matches with exactly one of the beans name in XML file.
  4. constructor: It injects the dependency by calling the constructor of the class. It has a large number of parameters.
  5. autodetect: First the container tries to wire using autowire by constructor, if it can’t then it tries to autowire by byType.

[/vc_column_text][/vc_tta_section][vc_tta_section title=” What are the limitations with auto wiring?” tab_id=”1584629309112-98763564-9195″][vc_column_text]Following are some of the limitations you might face with auto wiring:

  • Overriding possibility: You can always specify dependencies using <constructor-arg> and <property> settings which will override autowiring.
  •  Primitive data type: Simple properties such as primitives, Strings and Classes can’t be autowired.
  • Confusing nature: Always prefer using explicit wiring because autowiring is less precise.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What do you mean by Annotation-based container configuration?” tab_id=”1584629309761-1f24633f-a766″][vc_column_text]Instead of using XML to describe a bean wiring, the developer moves the configuration into the component class itself by using annotations on the relevant class, method, or field declaration. It acts as an alternative to XML setups. For example:

1
2
3
4
5
6
7
@Configuration
public class AnnotationConfig
{
@Bean
public MyDemo myDemo()
 { return new MyDemoImpll(); }
}

[/vc_column_text][/vc_tta_section][vc_tta_section title=”How annotation wiring can be turned on in Spring?” tab_id=”1584629311063-1d81af18-a5b9″][vc_column_text]By default, Annotation wiring is not turned on in the Spring container. Thus, to use annotation based wiring we must enable it in our Spring configuration file by configuring <context:annotation-config/> element. For example:

1
2
3
4
<beans xmlns="<a href="http://www.springframework.org/schema/beans">http://www.springframework.org/schema/beans</a>" xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" xmlns:context="<a href="http://www.springframework.org/schema/context">http://www.springframework.org/schema/context</a>">
<context:annotation-config/>
<beans ………… />
</beans>

[/vc_column_text][/vc_tta_section][/vc_tta_accordion][/vc_column][/vc_row]

WhatsApp us