Spring - Interview Questions and Answers for 'Spring bean' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Spring - Interview Questions and Answers for 'Spring bean' - 7 question(s) found - Order By Rating

 Q1. What is the difference between Singleton and Prototype Bean scope in Spring ?Spring
Ans. Prototype scope - A new object is created each time it is injected/looked up. It will use new SomeClass() each time.

Singleton scope - It is the default scope. The same object is returned each time it is injected/looked up. Here it will instantiate one instance of SomeClass and then return it each time.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     Spring beans  singleton bean scope  prototype bean scope     Asked in 1 Companies


 Q2. What are the disadvantages of Bean Auto Wiring in Spring ?Spring
Ans. It can always be overridden with explicit wiring. Moreover it's confusing if we use both explicit as well as explicit wiring in the project.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     Spring beans  auto wiring  autowiring


 Q3. Explain inner beans in Spring.Spring
 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     spring  spring beans   spring inner beans


 Q4. What is the use of @Bean annotation in Spring ?Spring
Ans. There are 2 ways to specify dependencies in Spring, one by the way of specifying beans in config files and other is by specifying annotations like @Bean, @Component , @Service etc to let spring know of the dependencies.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     spring bean annotation  spring annotations


 Q5. Can we have two beans with same class with different bean id in spring ?Spring
Ans. Yes

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     spring beans     Asked in 1 Companies


 Q6. Should we have instance variables in the Spring Bean which has been scoped as Singleton ?Spring
Ans. No, if required we should only have final variables.Bean scoped singleton means that only one instance of the bean will be created and will be shared among different requests and hence instance variables will get shared too.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   singleton   spring framework   spring beans


 Q7. Which class provides the enumerated value for Bean Scope ?

a. BeanDefinition
b. ConfigurableBeanFactory
c. WebApplicationContext
d. All of the Above
Spring
Ans. All of the Above

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     spring   spring beans   spring bean scope



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: