Dear readers, these Spring Interview Questions have been designed specially to get Spring is an open source development framework for enterprise Java. This is a summary of some of the most important questions concerning the Spring Framework, that you may be asked to answer in an interview or in an interview. This article features a great number of Spring interview questions Besides studying them online you may download the eBook in PDF format!.

Spring Interview Questions Pdf

Language:English, German, Arabic
Published (Last):15.04.2016
ePub File Size:15.38 MB
PDF File Size:8.53 MB
Distribution:Free* [*Registration needed]
Uploaded by: ROSEANN

Top 53 Spring Interview Questions And Answers Pdf. 2. What do you mean by Aspect? Answer: Aspect is a modularization of concern which cuts across multiple. + Questions and Answers on Spring, Spring Boot and Spring MVC spring- raudone.info · Adding interview questions pdf, 2 years ago. Spring interview questions: These Spring Interview Questions have been specially designed so Download Spring interview questions PDF.

Constructor Injection: Constructor-based DI is realized by invoking a constructor with a number of arguments, each representing a collaborator. What are the benefits of the Spring Framework transaction management?

Spring Framework supports: Programmatic transaction management. Declarative transaction management. Spring provides a unique transaction management abstraction, which enables a consistent programming model over a variety of underlying transaction technologies, such as JTA or JDBC.

Supports declarative transaction management. What is BeanFactory in Spring framework? A BeanFactory is an implementation fo the factory design patterns. The BeanFactory is a root interface for accessing a Spring bean container. This is the basic client view of a bean container; further interfaces such as ListableBeanFactory and ConfigurableBeanFactory are available for specific purposes.

This interface is implemented by 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 point of this approach is that the BeanFactory is a central registry of application components, and centralizes configuration of application components no more do individual objects need to read properties files. There are several implementations of BeanFactory in Spring.

But the most useful is org. Explain the different modules in Spring? Spring comprises of seven modules. There are three common forms of dependency injection: Dependency injection is a way to achieve loose coupling. Inversion of control IOC relates to the way in which an object obtains references to its dependencies. This is often done by a lookup method. The advantage of inversion of control is that it decouples objects from specific lookup mechanisms and implementations of the objects it depends on.

Spring Interview Questions

As a result, more flexibility is obtained for production applications as well as for testing. What are the different IOC containers available? Spring is an IOC container.

What are the different types of dependency injection? Explain with examples. There are two types of dependency injection: Setter Injection: Normally in all the java beans, we will use setter and getter method to set and get the value of property as follows:. We will create an instance of the bean 'namebean' say bean1 and set property as bean1. Constructor injection: For constructor injection, we use constructor with parameters as shown below,.

What is spring? What are the various parts of spring framework? What are the different persistence frameworks which could be used with spring? 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.

The Spring modules are built on top of the core container, which defines how beans are created, configured, and managed, as shown in the following figure. Each of the modules or components that comprise the Spring framework can stand on its own or be implemented jointly with one or more of the others.

The functionality of each component is as follows: The core container: The core container provides the essential functionality of the Spring framework.

A primary component of the core container is the BeanFactory, an implementation of the Factory pattern. Spring context: The Spring context is a configuration file that provides context information to the Spring framework.

Best Selling Java Interview Udemy Course

Spring AOP: The Spring AOP module integrates aspect-oriented programming functionality directly into the Spring framework, through its configuration management feature. As a result you can easily AOP-enable any object managed by the Spring framework. The Spring AOP module provides transaction management services for objects in any Spring-based application. Spring DAO: The Spring JDBC DAO abstraction layer offers a meaningful exception hierarchy for managing the exception handling and error messages thrown by different database vendors.

The exception hierarchy simplifies error handling and greatly reduces the amount of exception code you need to write, such as opening and closing connections. Spring ORM: Spring Web module: The Web context module builds on top of the application context module, providing contexts for Web-based applications.

As a result, the Spring framework supports integration with Jakarta Struts. The Web module also eases the tasks of handling multi-part requests and binding request parameters to domain objects. Spring MVC framework: What is AOP?

How does it relate with IOC? What are different tools to utilize AOP? Aspect-oriented programming, or AOP, is a programming technique that allows programmers to modularize crosscutting concerns, or behavior that cuts across the typical divisions of responsibility, such as logging and transaction management.

AOP and IOC are complementary technologies in that both apply a modular approach to complex problems in enterprise application development. In a typical object-oriented development approach you might implement logging functionality by putting logger statements in all your methods and Java classes.

In an AOP approach you would instead modularize the logging services and apply them declaratively to the components that required logging. The advantage, of course, is that the Java class doesn't need to know about the existence of the logging service or concern itself with any related code.

As a result, application code written using Spring AOP is loosely coupled. However AspectJ works at he byte code level and you need to use AspectJ compiler to get the AOP features built into your compiled code. Nevertheless AOP functionality is fully integrated into the Spring context for transaction management, logging, and various other features.

In general any AOP framework control aspects in three possible ways:. Points in a program's execution. For example, joinpoints could define calls to specific methods in a class Pointcuts: Program constructs to designate joinpoints and collect specific context at those points Advices: Code that runs upon meeting certain conditions.

For example, an advice could log a message before executing a joinpoint. What are the advantages of spring framework? Use what you need and leave you don't need now. There is no behind the scene magic here. POJO programming enables continuous integration and testability. Explain BeanFactory in spring. Bean factory is an implementation of the factory design pattern and its function is to create and dispense beans. As the bean factory knows about many objects within an application, it is able to create association between collaborating objects as they are instantiated.

This removes the burden of configuration from the bean and the client. There are several implementation of BeanFactory. The most useful one is "org.

The resource will provide the XML to the factory. But the bean factory doesn't instantiate the bean yet. To retrieve a bean from a 'BeanFactory', the getBean method is called.

When getBean method is called, factory will instantiate the bean and begin setting the bean's properties using dependency injection. Explain the role of ApplicationContext in spring. While Bean Factory is used for simple applications, the Application Context is spring's more advanced container. Like 'BeanFactory' it can be used to load bean definitions, wire beans together and dispense beans upon request. It also provide.

Because of additional functionality, 'Application Context' is preferred over a BeanFactory. Only when the resource is scarce like mobile devices, 'BeanFactory' is used.

Spring interview questions

The three commonly used implementation of 'Application Context' are. It Loads context definition from an XML file located in the classpath, treating context definitions as classpath resources.

It loads context definition from an XML file in the filesystem. It loads context definition from an XML file contained within a web application. How does Spring supports DAO in hibernate? It has handy methods you can call to get a Hibernate Session, or a SessionFactory. The most convenient method is getHibernateTemplate , which returns a HibernateTemplate.

This template wraps Hibernate checked exceptions with runtime exceptions, allowing your DAO interfaces to be Hibernate exception- free. What are the id generator classes in hibernate? It generates identifiers of type long, short or int that are unique only when no other process is inserting data into the same table.

It should not the used in the clustered environment. The returned identifier is of type long, short or int.

Spring Interview Questions

The returned identifier is of type long, short or int hilo: Do not use this generator with connections enlisted with JTA or with a user-supplied connection. The uuid generator uses a bit UUID algorithm to generate identifiers of type string, unique within a network the IP address is used. The UUID is encoded as a string of hexadecimal digits of length It picks identity, sequence or hilo depending upon the capabilities of the underlying database. How is a typical spring implementation look like?

For a typical Spring Application we need the following files 1. An interface that defines the functions.

An Implementation that contains properties, its setter and getter methods, functions etc. A XML file called Spring configuration file. Client program that uses the function. How do you define hibernate mapping file in spring? How do you configure spring in a web application?

It is very easy to configure any J2EE-based web application to use Spring. Can you have xyz.

How do you configure your database driver in spring? Using datasource "org. How can you configure JNDI instead of datasource in spring applicationcontext. Using "org. What are the key benefits of Hibernate? These are the key benefits of Hibernate: Session Level, Query and Second level cache. Lazy initialization, Outer join fetching, Batch fetching. What is hibernate session and session factory? How do you configure sessionfactory in spring configuration file?

Hibernate Session is the main runtime interface between a Java application and Hibernate. SessionFactory allows applications to create hibernate session by reading hibernate configurations file hibernate.

The call to Configuration. Once the configuration is initialized, you can make any additional modifications you desire programmatically.


An instance of SessionFactory is typically created once and used to create all sessions related to a given context. The main function of the Session is to offer create, read and delete operations for instances of mapped entity classes.

Instances may exist in one of three states:. A Hibernate Session object represents a single unit-of-work for a given data store and is opened by a SessionFactory instance.Varun Jadhav. What do you mean by AOP? Using Spring Frameworks middle-tier, it can be used as a third-party web framework. How do you have different configuration for different environments?

What is Auto Wiring? How do you configure 2nd level cach in hibernate?

DEVORAH from Memphis
Please check my other posts. I take pleasure in tennis polo. I do enjoy sharing PDF docs innocently .