Monday, February 27, 2017

spring interview questions

In this post i am sharing fundamental spring framework  interview questions for freshers and experienced candidates.This is one of the leading framework for developing enterprise  applications using Java Environment.Spring is an open source development framework for Enterprise Java. The main purpose of spring is for developing any Java application,but there are extensions for building web applications on top of the JEE platform. The following are some of the fundamental interview questions

1) What is spring?

Ans: Spring is open source development framework for Enterprise Java.By using this framework we can develop any type of Java application. This framework which helps Java programmer for development of code and it provides IOC container,Dependency Injector,MVC flow and many other APIs for the java programmer.Spring framework targets to make JEE development easier to use and promote good programming practice by enabling a POJO-based programming model.

2) What are the advantages of Spring Framework?

Ans: The following are the advantages of Spring Framework: They are

1)  Loose Coupling:
By using Inversion Of Control(IOC) can be achieved loose coupling in spring.
2) Easy to Test:
In spring framework,can be easily Test the code to improve the performance of the applications.
3) Light Weight:
Spring framework is light weight when it comes to size and transaparency.
4) Fast Development
5) Exception Handling:
Spring provides a convienient API to translate technology-specific exceptions into consistent,unchecked exceptions.
6) Transaction Management:
Spring provides a consistent transaction management interface that can scale up to global transactions.
7) MVC Framework:
Spring's web framework is a well designed web MVC framework,which provides a great alternative to web frameworks.

3) Why Spring Framework is needed?

Ans: Spring framework is needed because it is A light weight framework for building java applications. This means any type of java applications such as standalone java,JEE applications,web applications etc.. It also provides Inversion Of Control(IOC),Dependency Injecton(DI) capabilities and it also provides declarative programming with AOP(Aspect Oriented Programming).

4)What are the benefits of Spring Framework?

Ans: The following are the benefits of Spring Framework: They are


  • Reusability
  • Decoupling
  • Reduces coding effort by using pattern implementations such as singleton,factory,service locator etc..
  • Removal of leaking connections 
  • Declarative transaction management
  • Easy to integrate with third party tools and technologies

5) What are the modules used in spring framework?

Ans: The following are the basic spring modules:

  1. Core module
  2. Bean module
  3. Context module
  4. JDBC module
  5. ORM module
  6. Transaction module
  7. web module
  8. JMS module
6) What is Spring IOC container?

Ans: The Spring IoC container for creating the objects,managing them(dependency injection(DI)),writing them together,configuring them as also meaning their complete life cycle.IOC is also known as Dependency injection(DI). IOC a design pattern by which Loose coupling is achieved in Spring.Since the objects give their dependencies instead of creating or looking for dependent objects.



7) What are the benefits of using IOC?

Ans. It reduces the amount of coding required for the application. This allows the testing of the application to be done quickly and easily as no JNDI lookup mechanism or singletons are required. IoC containers also support lazy loading and eager installation of services.

8) What is the role of IoC container?

Ans: The role of IoC container in spring  is to instantiate,configure and assemble the objects.

9) What is BeanFactory?

Ans: A BeanFactory is an implementation of the factory pattern that applies inversion of control to separate the application's configuration and dependencies from the actual application code. The most commonly used BeanFactory implementation is the XmlBeanFactory class

10) What are the common implementation of the Application Context?

Ans: The FileSystemXmlApplicationContext container loads the definitions of the beans from an XML file. The full path of the XML bean configuration file must be provided to the constructor.

The ClassPathXmlApplicationContext container also loads the definitions of the beans from an XML file. Here,you need to set CLASSPATH properly because this container will look bean configuration XML file in CLASSPATH

The WebXmlApplicationContext container loads the XML file with definitions of all beans from within a web application.

11) Difference between BeanFactory and ApplicationContext?

Ans:  ApplicationContext provides a means for resolving text messages,a generic way to load file resources(such as images),they can publish events to beans that are registered as listeners. In addition,operations on the container or beans in the container,which have to be handled in a programmatic fashion with a bean factory,can be handled declarative in an application context. The application context implements MessageSource,an interface used to obtain localized messages,with the actual implementation being pluggable.

Recommended to READ:
JDBC Interview Questions
JSP Interview Questions
Servlet Interview Questions
Struts Interview Questions
Hibernate Interview Questions
MVC Architecture in Java


No comments:

Post a Comment

High Paying Jobs after Learning Python

Everyone knows Python is one of the most demand Programming Language. It is a computer programming language to build web applications and sc...