Monday 23 September 2013

Why Java Spring? Continued...

In Last Session one of the question stood tall and went unanswered

How Spring Identifies The Bean?

The answer to this question actually drags us to a most popular and second important feature of Spring, Dependency Injection. we will surely look into it but let us concentrate on the current question,
  1.  All Our Application Components i.e. Beans will live within Spring Container
  2. Spring comes with several container implementations that can be categorized into two distinct types.
    • Bean factories (org.springframework.beans.factory.BeanFactory interface)
    • Application contexts (org.springframework.context.ApplicationContext)
  3.  Bean Information will be placed in xml based file inside the <bean> tag and this xml file will be loaded to the spring container then container will identify these beans along with the properties set inside <bean> tag
  4. the bean tag typically look like this
    • <bean id="hello" class="com.srinidhi.beans.Helloworld"/> 
    • The <bean> element is the most basic configuration unit in Spring. It tells Spring to
      create an object for you.
  5. once you specify the bean info in xml following code can be used to load xml to spring application context
    •  ApplicationContext context = new ClassPathXmlApplicationContext(
      "hello.xml");
well this is much of a concept and also we are still pending with our previous session question of  "What are The Configuration for setting up spring???"... also there is much to talk about the variants of Application Context. 
these topics will be taken care in further sessions, thank u for reading.


No comments:

Post a Comment