Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

What Is Ioc (or Dependency Injection)?

Answer»

The basic concept of the Inversion of Control pattern (also KNOWN as dependency injection) is that you do not create your objects but describe how they should be created. You don't directly connect your components and services together in code but describe which services are needed by which components in a configuration file. A container (in the case of the Spring framework, the IOC container) is then RESPONSIBLE for hooking it all up.
i.e., Applying IoC, objects are given their dependencies at creation time by some EXTERNAL entity that COORDINATES each object in the system. That is, dependencies are injected into objects. So, IoC MEANS an inversion of responsibility with regard to how an object obtains references to collaborating objects.

The basic concept of the Inversion of Control pattern (also known as dependency injection) is that you do not create your objects but describe how they should be created. You don't directly connect your components and services together in code but describe which services are needed by which components in a configuration file. A container (in the case of the Spring framework, the IOC container) is then responsible for hooking it all up.
i.e., Applying IoC, objects are given their dependencies at creation time by some external entity that coordinates each object in the system. That is, dependencies are injected into objects. So, IoC means an inversion of responsibility with regard to how an object obtains references to collaborating objects.

2.

What Are The Different Types Of Ioc (dependency Injection) ?

Answer»

There are three types of DEPENDENCY injection:
• Constructor Injection (e.g. Pico container, Spring etc): DEPENDENCIES are provided as constructor parameters.
• Setter Injection (e.g. Spring): Dependencies are assigned through JAVABEANS PROPERTIES (ex: setter methods).
• Interface Injection (e.g. Avalon): Injection is done through an interface.

There are three types of dependency injection:
• Constructor Injection (e.g. Pico container, Spring etc): Dependencies are provided as constructor parameters.
• Setter Injection (e.g. Spring): Dependencies are assigned through JavaBeans properties (ex: setter methods).
• Interface Injection (e.g. Avalon): Injection is done through an interface.

3.

What Are The Benefits Of Ioc (dependency Injection)?

Answer»

Benefits of IOC (Dependency Injection) are as follows:
• Minimizes the amount of code in your application. With IOC containers you do not care about how services are created and how you get references to the ones you need. You can also easily add additional services by adding a new constructor or a setter method with LITTLE or no EXTRA configuration.
• Make your application more testable by not requiring any singletons or JNDI lookup mechanisms in your unit test cases. IOC containers make unit testing and switching implementations very easy by manually ALLOWING you to inject your own objects into the object under test.
• Loose coupling is promoted with minimal effort and least intrusive mechanism. The factory design pattern is more intrusive because components or services need to be requested explicitly WHEREAS in IOC the dependency is injected into requesting piece of code. Also some containers promote the design to interfaces not to implementations design concept by encouraging managed objects to implement a well-defined service interface of your own.
• IOC containers support eager instantiation and lazy loading of services. Containers also provide support for instantiation of managed objects, cyclical DEPENDENCIES, life cycles management, and dependency resolution between managed objects etc.

Benefits of IOC (Dependency Injection) are as follows:
• Minimizes the amount of code in your application. With IOC containers you do not care about how services are created and how you get references to the ones you need. You can also easily add additional services by adding a new constructor or a setter method with little or no extra configuration.
• Make your application more testable by not requiring any singletons or JNDI lookup mechanisms in your unit test cases. IOC containers make unit testing and switching implementations very easy by manually allowing you to inject your own objects into the object under test.
• Loose coupling is promoted with minimal effort and least intrusive mechanism. The factory design pattern is more intrusive because components or services need to be requested explicitly whereas in IOC the dependency is injected into requesting piece of code. Also some containers promote the design to interfaces not to implementations design concept by encouraging managed objects to implement a well-defined service interface of your own.
• IOC containers support eager instantiation and lazy loading of services. Containers also provide support for instantiation of managed objects, cyclical dependencies, life cycles management, and dependency resolution between managed objects etc.

4.

What Are The Common Implementations Of The Application Context ?

Answer»

The three commonly used implementation of 'APPLICATION Context' are
• ClassPathXmlApplicationContext : It LOADS context definition from an XML file located in the classpath, treating context definitions as classpath resources. The application context is LOADED from the application's classpath by using the code .
ApplicationContext context = new
ClassPathXmlApplicationContext("bean.xml");
• FileSystemXmlApplicationContext : It loads context definition from an XML file in the FILESYSTEM. The application context is loaded from the file system by using the code .
ApplicationContext context = new
FileSystemXmlApplicationContext("bean.xml");
• XmlWebApplicationContext : It loads context definition from an XML file contained within a web application.

The three commonly used implementation of 'Application Context' are
• ClassPathXmlApplicationContext : It Loads context definition from an XML file located in the classpath, treating context definitions as classpath resources. The application context is loaded from the application's classpath by using the code .
ApplicationContext context = new
ClassPathXmlApplicationContext("bean.xml");
• FileSystemXmlApplicationContext : It loads context definition from an XML file in the filesystem. The application context is loaded from the file system by using the code .
ApplicationContext context = new
FileSystemXmlApplicationContext("bean.xml");
• XmlWebApplicationContext : It loads context definition from an XML file contained within a web application.

5.

What Is Java Server Faces (jsf) - Spring Integration Mechanism?

Answer»

Spring provides a custom JavaServer Faces VariableResolver implementation that extends the standard JavaServer Faces managed beans mechanism. When asked to resolve a variable name, the following algorithm is PERFORMED:
• Does a bean with the SPECIFIED name already exist in some scope (request, session, application) If so, return it
• Is there a standard JavaServer Faces managed bean definition for this variable name? If so, invoke it in the usual way, and return the bean that was created.
• Is there CONFIGURATION information for this variable name in the Spring WebApplicationContext for this application? If so, use it to create and configure an instance, and return that instance to the caller.
• If there is no managed bean or Spring definition for this variable name, return null INSTEAD.
• BeanFactory also takes part in the life cycle of a bean, making calls to custom initialization and destruction methods. As a result of this algorithm, you can TRANSPARENTLY use either JavaServer Faces or Spring facilities to create beans on demand.

Spring provides a custom JavaServer Faces VariableResolver implementation that extends the standard JavaServer Faces managed beans mechanism. When asked to resolve a variable name, the following algorithm is performed:
• Does a bean with the specified name already exist in some scope (request, session, application) If so, return it
• Is there a standard JavaServer Faces managed bean definition for this variable name? If so, invoke it in the usual way, and return the bean that was created.
• Is there configuration information for this variable name in the Spring WebApplicationContext for this application? If so, use it to create and configure an instance, and return that instance to the caller.
• If there is no managed bean or Spring definition for this variable name, return null instead.
• BeanFactory also takes part in the life cycle of a bean, making calls to custom initialization and destruction methods. As a result of this algorithm, you can transparently use either JavaServer Faces or Spring facilities to create beans on demand.

6.

What Is Significance Of Jsf- Spring Integration ?

Answer»

Spring - JSF integration is useful when an EVENT handler wishes to explicitly invoke the bean FACTORY to create beans on demand, such as a bean that ENCAPSULATES the business logic to be PERFORMED when a submit button is PRESSED.

Spring - JSF integration is useful when an event handler wishes to explicitly invoke the bean factory to create beans on demand, such as a bean that encapsulates the business logic to be performed when a submit button is pressed.

7.

What Are Orm's Spring Supports ?

Answer»

SPRING supports the FOLLOWING ORM’s :
HIBERNATE
• iBatis
• JPA (Java Persistence API)
TOPLINK
• JDO (Java Data OBJECTS)
• OJB

Spring supports the following ORM’s :
• Hibernate
• iBatis
• JPA (Java Persistence API)
• TopLink
• JDO (Java Data Objects)
• OJB

8.

What Are The Ways To Access Hibernate Using Spring ?

Answer»

There are TWO approaches to SPRING’s Hibernate integration:
INVERSION of CONTROL with a HibernateTemplate and Callback
• Extending HIBERNATEDAOSUPPORT and Applying an AOP Interceptor

There are two approaches to Spring’s Hibernate integration:
• Inversion of Control with a HibernateTemplate and Callback
• Extending HibernateDaoSupport and Applying an AOP Interceptor

9.

How To Integrate Spring And Hibernate Using Hibernatedaosupport?

Answer»

SPRING and Hibernate can integrate using Spring’s SessionFactory CALLED LocalSessionFactory. The INTEGRATION process is of 3 steps.
• Configure the Hibernate SessionFactory
• Extend your DAO Implementation from HIBERNATEDAOSUPPORT
WIRE in Transaction Support with AOP

Spring and Hibernate can integrate using Spring’s SessionFactory called LocalSessionFactory. The integration process is of 3 steps.
• Configure the Hibernate SessionFactory
• Extend your DAO Implementation from HibernateDaoSupport
• Wire in Transaction Support with AOP

10.

How The Aop Used In Spring?

Answer»

AOP is USED in the Spring Framework: To provide declarative ENTERPRISE services, especially as a replacement for EJB declarative services. The most important such service is declarative transaction MANAGEMENT, which builds on the Spring Framework's transaction abstraction.To allow users to IMPLEMENT custom aspects, complementing their use of OOP with AOP.

AOP is used in the Spring Framework: To provide declarative enterprise services, especially as a replacement for EJB declarative services. The most important such service is declarative transaction management, which builds on the Spring Framework's transaction abstraction.To allow users to implement custom aspects, complementing their use of OOP with AOP.

11.

What Do You Mean By Aspect ?

Answer»

A modularization of a concern that cuts across MULTIPLE objects. Transaction management is a good example of a crosscutting concern in J2EE applications. In Spring AOP, aspects are IMPLEMENTED USING regular classes (the schema-based APPROACH) or regular classes annotated with the @Aspect annotation (@AspectJ style).

A modularization of a concern that cuts across multiple objects. Transaction management is a good example of a crosscutting concern in J2EE applications. In Spring AOP, aspects are implemented using regular classes (the schema-based approach) or regular classes annotated with the @Aspect annotation (@AspectJ style).

12.

What Do You Mean By Jointpoint?

Answer»

A POINT during the execution of a program, such as the execution of a METHOD or the handling of an EXCEPTION. In SPRING AOP, a join point always represents a method execution.

A point during the execution of a program, such as the execution of a method or the handling of an exception. In Spring AOP, a join point always represents a method execution.

13.

What Do You Mean By Advice?

Answer»

ACTION taken by an aspect at a particular JOIN point. Different TYPES of advice INCLUDE "around," "before" and "after" advice. Many AOP frameworks, including Spring, model an advice as an INTERCEPTOR, maintaining a chain of interceptors "around" the join point.

Action taken by an aspect at a particular join point. Different types of advice include "around," "before" and "after" advice. Many AOP frameworks, including Spring, model an advice as an interceptor, maintaining a chain of interceptors "around" the join point.

14.

What Are The Types Of The Transaction Management Spring Supports ?

Answer»

SPRING Framework SUPPORTS:
PROGRAMMATIC TRANSACTION MANAGEMENT.
• Declarative transaction management.

Spring Framework supports:
• Programmatic transaction management.
• Declarative transaction management.

15.

What Are The Benefits Of The Spring Framework Transaction Management ?

Answer»

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.

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.

16.

Why Most Users Of The Spring Framework Choose Declarative Transaction Management ?

Answer»

Most users of the Spring Framework choose declarative transaction management because it is the OPTION with the least impact on application CODE, and HENCE is most consistent with the ideals of a non-invasive lightweight container.

Most users of the Spring Framework choose declarative transaction management because it is the option with the least impact on application code, and hence is most consistent with the ideals of a non-invasive lightweight container.

17.

Explain The Similarities And Differences Between Ejb Cmt And The Spring Framework's Declarative Transaction Management ?

Answer»

The basic approach is similar: it is POSSIBLE to SPECIFY transaction behavior (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 rollback rules: this is a feature with no EJB equivalent. Both programmatic and declarative support for rollback rules is provided.
• The Spring Framework gives you an opportunity to customize transactional behavior, USING AOP. With EJB CMT, you have no way to influence the CONTAINER's transaction management other than setRollbackOnly().
• The Spring Framework does not support propagation of transaction contexts across remote calls, as do high-end application servers.

The basic approach is similar: it is possible to specify transaction behavior (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 rollback rules: this is a feature with no EJB equivalent. Both programmatic and declarative support for rollback rules is provided.
• The Spring Framework gives you an opportunity to customize transactional behavior, using AOP. With EJB CMT, you have no way to influence the container's transaction management other than setRollbackOnly().
• The Spring Framework does not support propagation of transaction contexts across remote calls, as do high-end application servers.

18.

When To Use Programmatic And Declarative Transaction Management ?

Answer»

Programmatic transaction management is usually a GOOD idea only if you have a small number of TRANSACTIONAL operations.

On the other HAND, if your application has numerous transactional operations, declarative transaction management is usually worthwhile. It keeps transaction management out of business LOGIC, and is not difficult to CONFIGURE.

Programmatic transaction management is usually a good idea only if you have a small number of transactional operations.

On the other hand, if your application has numerous transactional operations, declarative transaction management is usually worthwhile. It keeps transaction management out of business logic, and is not difficult to configure.

19.

Explain About The Spring Dao Support ?

Answer»

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.

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.

20.

What Are The Exceptions Thrown By The Spring Dao Classes ?

Answer»

SPRING DAO classes THROW exceptions which are subclasses of DataAccessException . Spring provides a convenient translation from technology-specific exceptions like SQLException to its own EXCEPTION class hierarchy with the DataAccessException as the root exception. These exceptions wrap the ORIGINAL exception.

Spring DAO classes throw exceptions which are subclasses of DataAccessException . Spring provides a convenient translation from technology-specific exceptions like SQLException to its own exception class hierarchy with the DataAccessException as the root exception. These exceptions wrap the original exception.

21.

What Is Sqlexceptiontranslator ?

Answer»

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.Data Access EXCEPTION.

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.Data Access Exception.

22.

What Is Spring's Jdbctemplate ?

Answer»

Spring's JDBCTEMPLATE is CENTRAL class to interact with a database through JDBC. JdbcTemplate provides many convenience methods for doing things such as converting database DATA into primitives or objects, executing prepared and callable statements, and providing custom database ERROR handling.
JdbcTemplate template = new JdbcTemplate(myDataSource);

Spring's JdbcTemplate is central class to interact with a database through JDBC. JdbcTemplate provides many convenience methods for doing things such as converting database data into primitives or objects, executing prepared and callable statements, and providing custom database error handling.
JdbcTemplate template = new JdbcTemplate(myDataSource);

23.

What Is Preparedstatementcreator ?

Answer»

PreparedStatementCreator:
• Is one of the most common used interfaces for writing DATA to database.
• Has one METHOD –createPreparedStatement(Connection)
RESPONSIBLE for creating a PreparedStatement.
• Does not NEED to HANDLE SQLExceptions.

PreparedStatementCreator:
• Is one of the most common used interfaces for writing data to database.
• Has one method –createPreparedStatement(Connection)
• Responsible for creating a PreparedStatement.
• Does not need to handle SQLExceptions.

24.

What Is Sqlprovider ?

Answer»

SQLPROVIDER:
• Has one METHOD – getSql()
TYPICALLY implemented by PREPAREDSTATEMENTCREATOR implementers.
• Useful for debugging.

SQLProvider:
• Has one method – getSql()
• Typically implemented by PreparedStatementCreator implementers.
• Useful for debugging.

25.

What Is Rowcallbackhandler ?

Answer»

The RowCallbackHandler interface EXTRACTS VALUES from each row of a ResultSet.
• Has ONE METHOD – processRow(ResultSet)
• Called for each row in ResultSet.
• Typically STATEFUL.

The RowCallbackHandler interface extracts values from each row of a ResultSet.
• Has one method – processRow(ResultSet)
• Called for each row in ResultSet.
• Typically stateful.

26.

What Are The Different Types Of Autoproxying?

Answer»

► BeanNameAutoProxyCreator
► DefaultAdvisorAutoProxyCreator
METADATA AUTOPROXYING

► BeanNameAutoProxyCreator
► DefaultAdvisorAutoProxyCreator
► Metadata autoproxying

27.

What Are The Different Advice Types In Spring?

Answer»

AROUND : INTERCEPTS the calls to the target METHOD
► Before : This is called before the target method is INVOKED
► After : This is called after the target method is returned
THROWS : This is called when the target method throws and exception

► Around : org.aopalliance.intercept.MethodInterceptor
► Before : org.springframework.aop.BeforeAdvice
► After : org.springframework.aop.AfterReturningAdvice
► Throws : org.springframework.aop.ThrowsAdvice

► Around : Intercepts the calls to the target method
► Before : This is called before the target method is invoked
► After : This is called after the target method is returned
► Throws : This is called when the target method throws and exception

► Around : org.aopalliance.intercept.MethodInterceptor
► Before : org.springframework.aop.BeforeAdvice
► After : org.springframework.aop.AfterReturningAdvice
► Throws : org.springframework.aop.ThrowsAdvice

28.

What Are The Different Points Where Weaving Can Be Applied?

Answer»

COMPILE TIME
► Classload Time
RUNTIME

► Compile Time
► Classload Time
► Runtime

29.

What Is Meant By Weaving?

Answer»

The PROCESS of applying aspects to a TARGET object to create a NEW proxy object is called as Weaving. The aspects are woven into the target object at the specified JOIN points.

The process of applying aspects to a target object to create a new proxy object is called as Weaving. The aspects are woven into the target object at the specified join points.

30.

What Is A Proxy?

Answer»

A PROXY is an OBJECT that is created after APPLYING advice to a TARGET object. When you think of client objects the target object and the proxy object are the same.

A proxy is an object that is created after applying advice to a target object. When you think of client objects the target object and the proxy object are the same.

31.

What Is A Target?

Answer»

A target is the class that is being advised. The class can be a third PARTY class or your own class to which you WANT to add your own custom behavior. By using the CONCEPTS of AOP, the target class is free to center on its MAJOR concern, unaware to any advice that is being APPLIED.

A target is the class that is being advised. The class can be a third party class or your own class to which you want to add your own custom behavior. By using the concepts of AOP, the target class is free to center on its major concern, unaware to any advice that is being applied.

32.

What Is An Introduction In Aop?

Answer»

An introduction allows the user to ADD NEW methods or attributes to an existing CLASS. This can then be introduced to an existing class without having to change the structure of the class, but give them the new behavior and state.

An introduction allows the user to add new methods or attributes to an existing class. This can then be introduced to an existing class without having to change the structure of the class, but give them the new behavior and state.

33.

What Is An Advice?

Answer»

Advice is the implementation of an ASPECT. It is SOMETHING LIKE TELLING your APPLICATION of a new behavior. Generally, and advice is inserted into an application at joinpoints.

Advice is the implementation of an aspect. It is something like telling your application of a new behavior. Generally, and advice is inserted into an application at joinpoints.

34.

What Is A Jointpoint?

Answer»

A joinpoint is a point in the execution of the application where an aspect can be plugged in. This point could be a method being CALLED, an exception being thrown, or even a FIELD being MODIFIED. These are the points where your aspects code can be inserted into the normal flow of your application to ADD new behavior.

A joinpoint is a point in the execution of the application where an aspect can be plugged in. This point could be a method being called, an exception being thrown, or even a field being modified. These are the points where your aspects code can be inserted into the normal flow of your application to add new behavior.

35.

What Are Different Types Of Autowire Types?

Answer»

There are FOUR different TYPES by which autowiring can be done.
BYNAME
► byType
CONSTRUCTOR
► autodetect

There are four different types by which autowiring can be done.
► byName
► byType
► constructor
► autodetect

36.

What Are The Different Types Of Bean Injections?

Answer»

There are two types of BEAN INJECTIONS.
1. By SETTER
2. By constructor

There are two types of bean injections.
1. By setter
2. By constructor

37.

What Are Inner Beans?

Answer»

When wiring beans, if a BEAN element is embedded to a property TAG directly, then that bean is said to the INNER Bean. The DRAWBACK of this bean is that it cannot be reused anywhere else.

When wiring beans, if a bean element is embedded to a property tag directly, then that bean is said to the Inner Bean. The drawback of this bean is that it cannot be reused anywhere else.

38.

What Are The Important Beans Lifecycle Methods?

Answer»

There are TWO important bean lifecycle methods. The first one is SETUP which is called when the bean is loaded in to the CONTAINER. The SECOND method is the teardown method which is called when the bean is unloaded from the container.

There are two important bean lifecycle methods. The first one is setup which is called when the bean is loaded in to the container. The second method is the teardown method which is called when the bean is unloaded from the container.

39.

How To Integrate Your Struts Application With Spring?

Answer»

To integrate your Struts APPLICATION with Spring, we have two options:
► Configure Spring to manage your ACTIONS as beans, USING the ContextLoaderPlugin, and SET their dependencies in a Spring context file.
► Subclass Spring's ActionSupport classes and grab your Spring-managed beans explicitly using a getWebApplicationContext() METHOD.

To integrate your Struts application with Spring, we have two options:
► Configure Spring to manage your Actions as beans, using the ContextLoaderPlugin, and set their dependencies in a Spring context file.
► Subclass Spring's ActionSupport classes and grab your Spring-managed beans explicitly using a getWebApplicationContext() method.

40.

What Is Significance Of Jsf- Spring Integration?

Answer»

SPRING - JSF integration is USEFUL when an EVENT handler wishes to explicitly invoke the bean factory to create beans on demand, such as a bean that encapsulates the business logic to be performed when a submit BUTTON is pressed.

Spring - JSF integration is useful when an event handler wishes to explicitly invoke the bean factory to create beans on demand, such as a bean that encapsulates the business logic to be performed when a submit button is pressed.

41.

Explain Bean Lifecycle In Spring Framework?

Answer»

1. The spring container finds the beans DEFINITION from the XML file and instantiates the bean.
2. USING the dependency INJECTION, spring populates all of the properties as specified in the bean definition.
3. If the bean implements the BeanNameAware interface, the factory calls setBeanName() passing the beans ID.
4. If the bean implements the BeanFactoryAware interface, the factory calls setBeanFactory(), passing an instance of itself.
5. If there are any BeanPostProcessors associated with the bean, their post- ProcessBeforeInitialization() methods will be CALLED.
6. If an init-method is specified for the bean, it will be called.
7. Finally, if there are any BeanPostProcessors associated with the bean, their postProcessAfterInitialization() methods will be called.

1. The spring container finds the beans definition from the XML file and instantiates the bean.
2. Using the dependency injection, spring populates all of the properties as specified in the bean definition.
3. If the bean implements the BeanNameAware interface, the factory calls setBeanName() passing the beans ID.
4. If the bean implements the BeanFactoryAware interface, the factory calls setBeanFactory(), passing an instance of itself.
5. If there are any BeanPostProcessors associated with the bean, their post- ProcessBeforeInitialization() methods will be called.
6. If an init-method is specified for the bean, it will be called.
7. Finally, if there are any BeanPostProcessors associated with the bean, their postProcessAfterInitialization() methods will be called.

42.

What Is Xmlbeanfactory?

Answer»

BeanFactory has many implementations in Spring. But one of the most useful one is org .spring framework .beans .factory .XML .XmlBeanFactory, which loads its beans based on the definitions contained in an XML file. To create an XmlBeanFactory, pass a java.io.InputStream to the constructor. The INPUT Stream will PROVIDE the XML to the factory. For EXAMPLE, the following code snippet uses a java .io .FileInput Stream to provide a bean definition XML file to XmlBeanFactory.

BeanFactory has many implementations in Spring. But one of the most useful one is org .spring framework .beans .factory .xml .XmlBeanFactory, which loads its beans based on the definitions contained in an XML file. To create an XmlBeanFactory, pass a java.io.InputStream to the constructor. The Input Stream will provide the XML to the factory. For example, the following code snippet uses a java .io .FileInput Stream to provide a bean definition XML file to XmlBeanFactory.

43.

What Does A Simple Spring Application Contain?

Answer»

These applications are like any Java application. They are made up of several classes, each performing a specific PURPOSE WITHIN the application. But these classes are configured and INTRODUCED to each other through an XML file. This XML file describes how to configure the classes, known as the Spring CONFIGURATION file.

These applications are like any Java application. They are made up of several classes, each performing a specific purpose within the application. But these classes are configured and introduced to each other through an XML file. This XML file describes how to configure the classes, known as the Spring configuration file.

44.

What Is Web Module?

Answer»

This module is built on the application context module, providing 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.

This module is built on the application context module, providing 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.

45.

What Are Object/relational Mapping Integration Module?

Answer»

Spring also supports for using of an object/relational mapping (ORM) tool over straight JDBC by providing the ORM module. Spring provide support to tie into SEVERAL popular ORM frameworks, including Hibernate, JDO, and iBATIS SQL Maps. Springs transaction MANAGEMENT supports each of these ORM frameworks as well as JDBC.

Spring also supports for using of an object/relational mapping (ORM) tool over straight JDBC by providing the ORM module. Spring provide support to tie into several popular ORM frameworks, including Hibernate, JDO, and iBATIS SQL Maps. Springs transaction management supports each of these ORM frameworks as well as JDBC.

46.

What Is Jdbc Abstraction And Dao Module?

Answer»

Using this module we can keep up the DATABASE CODE clean and simple, and prevent problems that result from a failure to close database resources. A new layer of meaningful exceptions on top of the error messages given by several database servers is bought in this module. In addition, this module USES Springs AOP module to provide transaction MANAGEMENT services for objects in a Spring application.

Using this module we can keep up the database code clean and simple, and prevent problems that result from a failure to close database resources. A new layer of meaningful exceptions on top of the error messages given by several database servers is bought in this module. In addition, this module uses Springs AOP module to provide transaction management services for objects in a Spring application.

47.

What Is Application Context Module?

Answer»

The Application context module makes spring a framework. This module extends the concept of BeanFactory, providing support for internationalization (I18N) messages, application LIFECYCLE events, and validation. This module also supplies many enterprise SERVICES such JNDI access, EJB integration, remoting, and scheduling. It also provides support to other framework.

The Application context module makes spring a framework. This module extends the concept of BeanFactory, providing support for internationalization (I18N) messages, application lifecycle events, and validation. This module also supplies many enterprise services such JNDI access, EJB integration, remoting, and scheduling. It also provides support to other framework.

48.

What Is The Core Container Module?

Answer»

This MODULE is PROVIDES the fundamental functionality of the spring framework. In this module BeanFactory is the heart of any spring-based application. The entire framework was built on the TOP of this module. This module MAKES the Spring container.

This module is provides the fundamental functionality of the spring framework. In this module BeanFactory is the heart of any spring-based application. The entire framework was built on the top of this module. This module makes the Spring container.

49.

What Is Delegatingvariableresolver?

Answer»

Spring provides a custom JavaServer Faces VariableResolver IMPLEMENTATION that extends the standard Java Server Faces managed beans mechanism which lets you use JSF and Spring TOGETHER. This VARIABLE RESOLVER is called as DelegatingVariableResolver

Spring provides a custom JavaServer Faces VariableResolver implementation that extends the standard Java Server Faces managed beans mechanism which lets you use JSF and Spring together. This variable resolver is called as DelegatingVariableResolver

50.

What Do You Mean By Auto Wiring?

Answer»

The Spring container is ABLE to AUTOWIRE relationships between collaborating beans. This means that it is possible to automatically LET Spring resolve collaborators (other beans) for your BEAN by inspecting the contents of the BEANFACTORY. The autowiring functionality has five modes.

► no
► byName
► byType
► constructor
► autodirect

The Spring container is able to autowire relationships between collaborating beans. This means that it is possible to automatically let Spring resolve collaborators (other beans) for your bean by inspecting the contents of the BeanFactory. The autowiring functionality has five modes.

► no
► byName
► byType
► constructor
► autodirect