Java - Interview Questions and Answers for GE Technical Interview

Q1.  What is bean auto wiring?

Ans. 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 without using <constructor-arg> and <property> elements.

Q2.  What is a ConcurrentHashMap ?

Ans. ConcurrentHashMap is a hashMap that allows concurrent modifications from multiple threads as there can be multiple locks on the same hashmap.

Q3.  What are the Bean scopes provided by Spring ?

Ans. Singleton , Prototype , Request , Session , global-session

Q4.  What are the various Auto Wiring types in Spring ?

Ans. By Name , By Type and Constructor.

Q5.  When should we use prototype scope and singleton scope for beans ?

Ans. We should use singleton scope for beans when they are stateless and prototype when they are stateful.