In this post i am sharing spring interview questions for experienced candidates.In my previous post i have shared spring interview questions for freshers,so first read basic spring interview questions and then come to this post.
1) What is JDBC abstraction and DAO module?
Ans: To keep database code clean and simple we use JDBC abstraction and DAO module and also prevent problems that result from a failure to close database resources. It also makes use of Spring's AOP module to provide transaction management services for objects in a Spring application.
2) How do you provide Configuration metadata to the Spring Container?
Ans: There are three important methods to provide configuration metadata to the Spring Container. They are
Ans: AutoWiring is used to build relationship between the collaborating beans. Spring container can automatically resolve collaborators for beans. There is @Autowired annotation provides more fine-grained control over where and how autowiring should be accomplished. This annotation can be used to autowire bean on the setter method just like @Required annotation,constructor,a property or methods with arbitrary names and/or multiple arguments.
4)What are the advantages of Spring AOP?
Ans: The advantages of Spring AOP are:
Ans: Autoproxying is used to create proxy automatically for the spring users. It provides following two classes to support this automatic proxy creation. There are different types of AutoProxying. They are
6) What is DAO in Spring?
Ans: DAO is used to provide integration of java database connectivity and Object relational mapping objects. DAO is spring framework provides connection for JDBC,hibernate,JDO,JPA,Common client interface and Oracle.The database code can be kept clean and simple by using the DAO module.Also,DAO module utilizes the AOP module to enable objects in the Spring application to use transaction management services.
7) What are the ways to access Hibernate by using Spring?
Ans: There are two ways to access Hibernate with Spring: They are
Ans: Using Spring's SessionFactory called LocalSessionFactory. The integration process is 3 steps. They are
Ans: There are mainly 3 types of benefits. They are
Ans: Spring support two types of Transaction Management. They are
Programmatic transaction management :
This means that you have managed the transaction with the help of programming. That gives you extreme flexibility,but it is difficult to maintain
Declarative transaction management:
This means you separate transaction management from the business code. You only use annotations or XML based configuration to manage the transactions.
11) Is Singleton beans are thread-safe in Spring framework?
Ans: NO, singleton beans are not thread-safe in Spring framework.
12) Can you inject null and empty string values in Spring?
Ans: YES, you can
13) What is web module?
Ans: The Spring web 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.
14) What is Cross cutting concern and concern in Spring AOP?
Ans: Cross cutting concern: It is a concern which is applicable throughout the application and it affects the entire application. Example: security,logging and data transfer are the concerns which are needed in almost every module of an application
Concern: It is a behavior that we want to have in a module of an application. Issues in which we are interested defines our concern
15) What is difference between singleton and prototype bean?
Ans:
Single bean definition to a single object instance per Spring IoC container.
single bean definition to any number of object instance per Spring IoC container.
Watch Video for more details: Spring Interview Questions for experienced
See Also:
Spring MVC Architecture
Basic Spring Interview Questions
Spring IoC container with examples
Hibernate Interview Questions
1) What is JDBC abstraction and DAO module?
Ans: To keep database code clean and simple we use JDBC abstraction and DAO module and also prevent problems that result from a failure to close database resources. It also makes use of Spring's AOP module to provide transaction management services for objects in a Spring application.
2) How do you provide Configuration metadata to the Spring Container?
Ans: There are three important methods to provide configuration metadata to the Spring Container. They are
- XML based configuration file
- Annotation based Configuration
- Java-based configuration
Ans: AutoWiring is used to build relationship between the collaborating beans. Spring container can automatically resolve collaborators for beans. There is @Autowired annotation provides more fine-grained control over where and how autowiring should be accomplished. This annotation can be used to autowire bean on the setter method just like @Required annotation,constructor,a property or methods with arbitrary names and/or multiple arguments.
4)What are the advantages of Spring AOP?
Ans: The advantages of Spring AOP are:
- It increases the modularity and the key unit is Aspect
- AOP breaks the program logic into distinct parts
- It provides the pluggable way to dynamically add the additional concern before,after or around the actual logic.
Ans: Autoproxying is used to create proxy automatically for the spring users. It provides following two classes to support this automatic proxy creation. There are different types of AutoProxying. They are
- BeanNameAutoProxyCreator
- DefaultAdvisorAutoProxyCreator
- MetadataAutoProxying
6) What is DAO in Spring?
Ans: DAO is used to provide integration of java database connectivity and Object relational mapping objects. DAO is spring framework provides connection for JDBC,hibernate,JDO,JPA,Common client interface and Oracle.The database code can be kept clean and simple by using the DAO module.Also,DAO module utilizes the AOP module to enable objects in the Spring application to use transaction management services.
7) What are the ways to access Hibernate by using Spring?
Ans: There are two ways to access Hibernate with Spring: They are
- Inversion of Control with a Hibernate Template and Callback
- Extending HibernateDAOSupport and Applying an AOP interceptor node.
Ans: Using Spring's SessionFactory called LocalSessionFactory. The integration process is 3 steps. They are
- Configure the Hibernate SessionFactory
- Extend a DAO implementation from HibernateDaoSupport
- Wire in Transaction Support with AOP
Ans: There are mainly 3 types of benefits. They are
- It integrates very will with spring's various data access abstractions.
- It provides consistent programming model across different transaction APIs such as JDBC,JPA,Hibernate and JDO.
- It supports declarative transaction management
Ans: Spring support two types of Transaction Management. They are
Programmatic transaction management :
This means that you have managed the transaction with the help of programming. That gives you extreme flexibility,but it is difficult to maintain
Declarative transaction management:
This means you separate transaction management from the business code. You only use annotations or XML based configuration to manage the transactions.
11) Is Singleton beans are thread-safe in Spring framework?
Ans: NO, singleton beans are not thread-safe in Spring framework.
12) Can you inject null and empty string values in Spring?
Ans: YES, you can
13) What is web module?
Ans: The Spring web 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.
14) What is Cross cutting concern and concern in Spring AOP?
Ans: Cross cutting concern: It is a concern which is applicable throughout the application and it affects the entire application. Example: security,logging and data transfer are the concerns which are needed in almost every module of an application
Concern: It is a behavior that we want to have in a module of an application. Issues in which we are interested defines our concern
15) What is difference between singleton and prototype bean?
Ans:
Single bean definition to a single object instance per Spring IoC container.
single bean definition to any number of object instance per Spring IoC container.
Watch Video for more details: Spring Interview Questions for experienced
See Also:
Spring MVC Architecture
Basic Spring Interview Questions
Spring IoC container with examples
Hibernate Interview Questions
ReplyDeleteAngularJS Certification Training in Chennai
This information you provided in the blog that is really unique I love it!! Thanks for sharing such a great blog Keep
ReplyDeleteposting..
Spring Interview Questions and Answers