Spring Flashcards
What is Spring framwork?
An open source development framework for Enterprise Java. With Spring we can develop large-scale complex Java applications very easily. It is based on good design patterns like Dependency Injection and Aspect Oriented Programming.
What are the benefits of spring?
Lightweight: basic spring framework is small in size.
Container: is provides the basic container that creates and ma ages the life cycle of application objects like POJO.
Dependency Injection: it provides loose coupling by dependency injection. Objects specify their dependencies to the Spring container.
Aspect Oriented Programming: This helps with separating application business logic from system services that are common across all business logic.
Transaction Management: spring provides a framework for transaction management that is scalable.
MVC: for web applications spring provides MVC framework based on the MVC design pattern.
What are the modules in the Core Container in spring?
Core Module, Bean Module, Context Module, Spring Expression Language Module.
What are the modules in the Data Access layer of Spring framework?
JDBC: abstraction layer to remove tedious JDBC coding.
ORM module: Integration layers for Object Relational Mapping
OXM module: abstraction layer to support Object XML mapping.
Transactions Module: Transaction management for POJO classes.
What kind of testing can be done in the Spring Test Module?
Provides support for Unit testing as well as Integration testing of Spring components. It also gives ability to mock objects to test code.
What is the use of BeanFactory?
This is the main class that helps in implementing Inversion of Control pattern, based on the factory design pattern.
It separates the configuration and dependencies of an application from the rest of the application code.
What is XMLBeanFactory in Spring?
It is one of the most useful implementations of BeanFactory in Spring. It loads its beans based on the definitions mentioned in an XML file.
What are the benefits of JDBC abstraction layer module in Spring?
Helps in keeping the database code clean & simple.
Prevents problems that result from failure to close database resources.
Provides a layer of useful exceptions.
Based on Springs AOP module.
Provides transaction management.
How does Spring support Object Relational Mapping integration?
Spring supports this by providing ORM module. This module helps integrating with popular ORM frameworks like Hibernate.
How does the Web module work in Spring framework?
Web module is built on application context module that provides context for web-based applications.
This module also supports integration with popular web frameworks like Jakarta Struts, JSF etc.
What are the main uses of Spring MVC module?
Spring-webmvc module (web-servlet module). Based on Web Model View Controller pattern. Helps with the integration of Spring with other MVC frameworks. Supports IoC to provide clear separation of controller logic from business objects. Provides clean separation between domain model code and web forms.
What is the purpose of Spring configuration file?
Spring applications can be configured by an XML file. This contains information of classes and how they should be configured.
What are the benefits of ApplicationContext in Spring?
Bean factory methods: these are used to access application components.
Load File Resources: helps in loading file resources in a generic fashion.
Publish Events: enables publishing events to registered listeners.
Parent Context: ability to inherit from a parent context.
What are the main components of a typical Spring based application?
Spring configuration XML file: used to configure the application.
API interfaces: Definition of API interfaces for functions provided by application.
Implementation: Application code with implementation of APIs
Aspects: Spring Aspects implemented by the application.
Client: Application at client side that is used for accessing functions.
Explain Dependency Injection concept in spring?
It is a software design pattern, used to implement Inversion of Control in Spring framework. With this pattern, we do not create objects in an application by calling new. Rather, we describe how an object should be created. In this way, creation of an object is not tightly coupled with another object.