Prev Next

Spring / Spring module questions

Could not find what you were looking for? send us the question and we would be happy to answer your question.

1. Explain the Core container module of Spring framework.

This module provides the fundamental functionality of the spring framework. A primary component of the core container module is the BeanFactory which is considered as the heart of any spring-based application.

The entire spring framework is built and operated on the top of this core module. This module makes the Spring container.

2. What is the Application context module of Spring framework?

The Application context module enables spring as a functional framework. This module extends the concept of BeanFactory, provides the support for internationalization (I18N) messages, application lifecycle events and validation.

This module enables many enterprise services such as JNDI access, EJB integration, remoting and scheduling. This module also facilitates easy integration with the other frameworks.

3. Describe AOP module in Spring framework.

Aspect Oriented Programming (AOP) enable OOP to have additional functionalities by intercepting across application modules/features.

The key unit of modularity in OOP is the class, whereas in AOP the unit of modularity is the aspect. Spring AOP (Aspect-oriented programming) framework modularize cross-cutting concerns in aspects as an interceptor to intercept processes,procedures and modules of OOP.

4. What are the features made available in different spring versions.

Annotations driven configuration is introduced in spring 2.5.

Spring 3 incorporated Java 5 features.

Spring 4 enables full support for Java 8 and the minimum supported Java version is SE 6.

5. Spring framework: Explain the JDBC abstraction and DAO module

JDBC abstraction and DAO module helps keep up the database code clean and simple, prevent problems that result from a failure to close database resources like connections.

It provides a layer of meaningful exceptions on top of the error messages thrown by several database servers.

It also makes use of Spring AOP module to provide transaction management services for objects in a Spring application.

6. Spring framework:Explain the object/relational mapping integration module.

Spring supports use of an object relational mapping (ORM) tool over JDBC by providing the ORM module.

Spring provides support to enable several popular ORM frameworks, including Hibernate, JDO, and iBATIS SQL Maps. Spring's transaction management supports each of these ORM frameworks as well as JDBC.

7. Spring framework: Explain the web module.

The Spring web module built on the application context module, provides a context that is appropriate for web-based applications. This module also contains support for several web-oriented tasks such as transparently handling multipart requests for file uploads and programmatic binding of request parameters to your business objects. It also contains integration support with Jakarta Struts.

8. Spring framework: Explain the Spring MVC module.

MVC framework is provided by Spring for building web applications. Spring can easily be integrated with other MVC frameworks, but Spring?s MVC framework is a better choice, since it uses IoC to provide for a clean separation of controller logic from business objects. With Spring MVC you can declaratively bind request parameters to your business objects.

9. What are the implementations of the ApplicationContext in Spring framework?

The FileSystemXmlApplicationContext container loads the definition of the beans from the Configuration XML file. The full path of the XML bean configuration file must be provided to the constructor.

The ClassPathXmlApplicationContext container also loads the definition 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.

AnnotationConfig ApplicationContext, a standalone application context, accepts annotated classes such as @Configuration-annotated classes also @Component types and JSR-330 compliant classes using javax.inject annotations.

10. Difference between applicationContext.xml and spring-servlet.xml in Spring Framework.

Spring allows you define multiple contexts in a parent-child hierarchy.

The applicationContext.xml defines the beans for the root webapp context, the context associated with the web application.

The spring-servlet.xml defines the beans for one servlet's app context. There can be many of these in a webapp, one per Spring servlet.

11. How do you implement inheritance in bean definition?

Bean definition inheritance can be implemented by specifying parent property of the bean equal to its parent bean definition id. This bean class must have extended itself from the parent bean class.

Spring Beans

Comments & Discussions