41.What are the types of the transaction management Spring supports ?
Spring Framework supports:
Programmatic transaction management.
Declarative transaction management.
42.What are the benefits of the Spring Framework transaction management ?
The Spring Framework provides a consistent abstraction for transaction management that delivers the following benefits:
Provides a consistent programming model across different transaction APIs such as JTA, JDBC, Hibernate, JPA, and JDO.
Supports declarative transaction management.
Provides a simpler API for programmatic transaction management than a number of complex transaction APIs such as JTA.
Integrates very well with Spring's various data access abstractions.
43.Explain the similarities and differences between EJB CMT and the Spring Framework's declarative transaction
management ?
The basic approach is similar: it is possible to specify transaction behaviour (or lack of it) down to individual method level.
It is possible to make a setRollbackOnly() call within a transaction context if necessary.
The differences are:
Unlike EJB CMT, which is tied to JTA, the Spring Framework's declarative transaction management works in any environment.
It can work with JDBC, JDO, Hibernate or other transactions under the covers, with configuration changes only.
The Spring Framework enables declarative transaction management to be applied to any class, not merely special classes such as EJBs.
The Spring Framework offers declarative roll-back rules: this is a feature with no EJB equivalent.
Both programmatic and declarative support for roll back rules is provided.
The Spring Framework gives you an opportunity to customize transactional behaviour, using AOP.
With EJB CMT, you have no way to influence the container's transaction management other than setRollbackOnly().
The
44.Explain about the Spring DAO support ?
The Data Access Object (DAO) support in Spring is aimed at making it easy to work with data access technologies like JDBC,
Hibernate or JDO in a consistent way. This allows one to switch between the persistence technologies fairly easily and
It also allows one to code without worrying about catching exceptions that are specific to each technology.
45.What is SQLExceptionTranslator ?
SQLExceptionTranslator, is an interface to be implemented by classes that can translate
between SQLExceptions and Spring's own data-access-strategy-agnostic org.springframework.dao.DataAccessException.
46. Name the various modules used in spring framework?
AOP module (Aspect Oriented Programming)
JDBC abstraction and DAO module
The Core container module
MVC framework module
Application context module
O/R mapping integration module (Object/Relational)
Web module
47.Why Spring framework is needed?
Spring framework is needed because it is –
Very Light Weight Container
Framework
IOC
AOP
48.Explain the RowCallbackHandler in Spring?
The RowCallbackHandler is called for each row in ResultSet and is used to read values from the ResultSet.
49.Write about AOP module?
AOP module is utilized for creating aspects for Spring applications.
It also enables support for metadata programming in Spring.
50. What is a BeanFactory Interface?
Bean factory interface is used to provide configuration framework for object creation
and basic functionality around object management.
51.What is Auto Wiring?
Autowiring is used to build relationships between the collaborating beans.
Spring container can automatically resolve collaborators for beans.
52.How to start using spring?
Following steps needs to be done to start with the Spring:
Download Spring and its dependent file from spring’s site.
Create application context xml to define beans and its dependencies
Integrate application context xml with web.xml
Deploy and Run the application
53.What are the methods of bean life cycle?
There are two important methods of Bean life cycle:
Setup – called when bean is loaded into container
Teardown – called when bean is unloaded into container
54.What are the different types of events of Listeners?
Following are the different types of events of listeners:
ContextClosedEvent – This event is called when the context is closed.
ContextRefreshedEvent – This event is called when context is initialized or refreshed
RequestHandledEvent – This event is called when the web context handles request
55.Differentiate between singleton and prototype bean?
Singleton means only one bean is defined per object instance
while Prototype means one definition to more than one object instances in Spring.
56.What are the types of Dependency Injection?
Two types of dependency injection are supported by spring framework:
Setter Injection
Constructor Injection
57.Write about Core container module?
Core container module is responsible for the basic functionality of the spring framework.
The whole Spring framework is built with this module as a base.
58.What is AOP Alliance?
AOP alliance is an open-source project which is aimed at promoting adoption of AOP.
The AOP alliance’s goal is to define a common set of components and interfaces so as to improve interoperability among different AOP implementations.
59.What are different types of Autowire?
There are four different types of Auto wire:
1.byName
2.byType
3.constructor
4.autodetect
60.When are declarative and programmatic transaction management used?
When only a small amount of transactional operations is there,
It is advised to use Programmatic transaction management.
But if there is a big amount of transactional operations to be taken care of,
declarative transaction management is preferred.