www.bullraider.com

You are here: Home Java Spring 3.0

Spring 3.0 IOC Walk-Through

AddThis Social Bookmark Button

Take a quick recap of Spring 3.0 IOC concepts.This article will help people who has knowledge on Spring 3.0 IOC and wants to quickly walk through the spring concepts.It could also help interviews.

 

Introduction to dependence injection and loose coupling.

  1. What is loose coupling ?
    The components of your application should assume as little as possible about other components. A loose coupled system is more flexible to enhance,and on the other hand a tightly coupled system is hard to enhance or lacks flexibility.
  2. How does a programmer achieve loose coupling in Java without using Spring ?
    In Java programming to the interfaces, increases loose coupling.For an example List is an interface and the implementation classes are ArrayList, LinkedList and Vector. While writing code that uses these implementation classes, rather writing code like ArrayList al=new ArrayList() , it is better to write List list=new ArrayList(). This way we can enhance loose coupling.
  3. What is DI or Dependency Injection  ?
    In OOP an object never stands alone , ie it needs or composed of certain other objects. The less the Composing object knows about the composed object is called loosely coupled system.But it is not possible to have no dependency or zero couple system. So , a Dependency Injection is a technique is OOP to resolve dependency between composed and composing object.
  4. What is the difference between DI ( Dependency Injection ) and IOC ( Inversion Of Control ) ?
  5. What is the difference between Dependacy pull and dependacy push  ?
     
  6.  

 

Introduction To Spring

  1. What is Spring ?
    Spring is a lightweight container and a framework provides your application to achieve loose coupling.It provides API to interact with the components managed by the container.
  2. Why they call Spring is a light weight container, What is the significance of light weight ?
    While we did not have Spring in place, we used to use the concept of Service Locator ( a form of IOC, also known as Dependency lookup) to locate our business components. And these business components ( For Ex: EJB) were made avaialable to the consumer  by the application server like JBoss, WebLogic etc. These servers are needed when our business objects are in client server environment, But what if our applications are not client server based ?. In this case application server are not useable and if ever can made usable, these are really big Java applications. Bad that we had to kill a mosquito by a cannon. Thanks to Spring which is much less in size and can be used in a desktop application, and the same code can be exposed as business component even in client/server environment. 
  3. What is Bean in Spring's context ?
    A Bean
  4. What is Bean Factory ?
    A BeanFactory is responsible for managing components and their dependencies
  5.  
Powered by Bullraider.com