Design - Interview Questions and Answers for 'Inject' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Interview Questions


 2802 questions in repository.
 There are more than 200 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

   



Design - Interview Questions and Answers for 'Inject' - 14 question(s) found - Order By Newest

Almost sure to be asked in every company using any Dependency Injection framework ( Spring, Guice etc )
  Q1. What is Dependency Injection or IOC ( Inversion of Control ) ?Design

Ans. It is a Design Pattern that facilitates loose coupling by sending the dependency information ( object references of dependent object ) while building the state of the object. Objects are designed in a manner where they receive instances of the objects from other pieces of code, instead of constructing them internally and hence provide better flexibility.

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

   Like      Discuss      Correct / Improve     design patterns   ioc ( Inversion of Control )  dependency injection     Nucleus Software Exports  HCL Technologies  Tata Consultancy (TCS)  HCL  Infosys  Cognizant (CTS)  Barclays  General Electric  Infosys Technologies  Elsevier  Sabre  ZapCom  Nike  Sogeti  CSG International  Lowes  DWS  Mitsui Bussan Logistics  Payment Processing Partners  Liquidnet  AmTrust Financial  VectorForm  Cybage  Vanderbilt University  Cigniti  Accenture  Ball Aerospace  GE Healthcare  1-800 Contacts  VinSolutions  Arrow Electronics  Monitise  Avenue Code  Thetus Corporation  Shodogg  Levi9  BuildLinks  Suyati Technologies  Kanerika Software  Alliance Inspection Management  Promega  Victorious  Zoll Data Systems  Parkmobile  PerceptiMed  Crate and Barrel  Carbonite  Concur  Codazen  GlobalLogic  AccuSoft  Attinad  Tillster  AppRiver  TrustPilot  Pearson  Kony  Art Technology Group  VeriSign  Accion Labs  IGS Energy  National Bankruptcy Services  RealPage  Green Dot  Indecomm Global  bebo Technologies  Open Solutions  Xoriant  NCR  Macmillan Cancer Support  NetSuite  Asynchrony Labs  DealDash  Vizio  Fiserv  Federal Reserve Bank of Minneapolis  Tinder  FICO  Trustwave      intermediate        frequent


 Q2. Name few Dependency Injection frameworks ?
admin
info@buggybread.com
Ans. Google Guice , Spring , PicoContainer and Dagger.

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

   Like      Discuss      Correct / Improve     dependency injection   di   frameworks   ioc


 Q3. What are the benefits of Dependency Injection or IOC ?Design2017-06-23 11:51:20

 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     dependency injection  IOC  inversion of control


 Q4. What are different types of dependency injections ?Design 2017-11-07 09:37:47

Ans. Setter injection
Constructor injection
Interface injection
Look-up method/method injection

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

   Like      Discuss      Correct / Improve     dependency injection   design patterns     IBM


Frequently asked in Phone Interviews.
 Q5. What are the various Auto Wiring types in Spring ?
Admin
info@buggybread.com
Ans. By Name , By Type and Constructor.

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

   Like      Discuss      Correct / Improve     java   spring   spring container   dependency injection   auto wiring   auto wiring types   general electric   ge


 Q6. What is the difference betweeen @Inject and @Autowired ?Spring
Admin
info@buggybread.com
Ans. @Autowired and @Inject are similar in terms of functionality they achieve. @Inject is part of a new Java technology called CDI that defines a standard for dependency injection whereas @Autowired is a Spring specific annotation for dependency injection.

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

   Like      Discuss      Correct / Improve     spring   web frameworks   dependency injection   autowired   inject   spring annotations   ioc


 Q7. Which of the following Java features facilitates Dependency Injection - Inheritance or Composition ? 2016-05-26 14:21:24

Ans. Composition for sure. Inheritance in case the reference of a parent class is used. If its interface, no Inheritance involved.

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

   Like      Discuss      Correct / Improve     dependency injection  IOC


 Q8. What are the different ways in which dependency injection can be done using Spring Framework ?Spring2017-06-23 11:48:58

Ans. Using Constructor and Setters.

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

   Like      Discuss      Correct / Improve     spring  dependency injection   inversion of control


 Q9. Difference between constructor and setter injection ?Spring2017-06-23 11:49:27

Ans. 1. In Setter Injection, partial injection of dependencies can possible, means if we have 3 dependencies like int, string, long, then its not necessary to inject all values if we use setter injection. If you are not inject it will takes default values for those primitives1. In constructor injection, partial injection of dependencies cannot possible, because for calling constructor we must pass all the arguments right, if not so we may get error

2. Setter Injection will overrides the constructor injection value, provided if we write setter and constructor injection for the same property [i already told regarding this, hope you remember ] But, constructor injection cannot overrides the setter injected values

3. If we have more dependencies for example 15 to 20 are there in our bean class then, in this case setter injection is not recommended as we need to write almost 20 setters right, bean length will increase. In this case, Constructor injection is highly recommended, as we can inject all the dependencies with in 3 to 4 lines [i mean, by calling one constructor]

4. Setter injection makes bean class object as mutable [We can change ] .Constructor injection makes bean class object as immutable [We cannot change ]

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

   Like      Discuss      Correct / Improve     spring  dependency injection   inversion of control     Sofi  HCL Technologies  Tata Consulancy (TCS)



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q10. Which of the OOP's features facilitate dependency injection ? Design2017-08-06 19:11:22

Ans. Inheritance , Runtime Polymorphism and Composition.

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

   Like      Discuss      Correct / Improve     dependency injection  inversion of control  ioc  oops  oops features


 Q11. Is dependency injection possible if we don't have inheritance / Composition ?Design2017-08-06 19:13:37

Ans. Without composition - No, as it's the core of dependency injection.

With Inheritance - Yes, through interface implementation.

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

   Like      Discuss      Correct / Improve     dependency injection  inversion of control  ioc


 Q12. What could be the driving force to have dependencies injected through class than through config file while using IOC or Dependency Injection ? Design2017-08-18 09:45:24

Ans. Unit Testing

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

   Like      Discuss      Correct / Improve     dependency injection  inversion of control


 Q13. What is setter injection ?Spring2018-06-16 08:00:08

Ans. Setter Injection in Spring is a type of dependency injection in which the framework injects the dependent objects into the client using a setter method.

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

   Like      Discuss      Correct / Improve     setter injection   dependency injection     HCL Technologies


 Q14. In which way are you using dependency injection in Spring ? Annotation , Config or Class ?Spring2018-06-27 09:52:07

Ans. Possible Answer - We are using config file.

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

   Like      Discuss      Correct / Improve     Dependency injection     Symantec




Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

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:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: