KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > albel > tags > table > utils > Beans


1 /*
2  * Beans.java
3  *
4  * Created on Antradienis, 2004, Rugsėjo 28, 17.55
5  */

6
7 package albel.tags.table.utils;
8
9 /**
10  *
11  * @author Albertas Laurinav
12  */

13 import org.springframework.beans.factory.BeanFactory;
14 import org.springframework.context.support.ClassPathXmlApplicationContext;
15 import org.springframework.beans.factory.BeanFactory;
16 public class Beans {
17     
18     private static Beans beans;
19     private ClassPathXmlApplicationContext cpx;
20     /** Creates a new instance of Beans */
21     private Beans() {
22         cpx=new ClassPathXmlApplicationContext("TableTagContext.xml");
23     }
24     public BeanFactory getFactory()
25     {
26         return (BeanFactory)cpx;
27     }
28     public static Object JavaDoc getBean(String JavaDoc id)
29     {
30         if(beans==null)
31             beans=new Beans();
32         Object JavaDoc bean=beans.getFactory().getBean(id);
33         return bean;
34     }
35 }
36
Popular Tags