Search Results

Search found 1 results on 1 pages for 'ceddoc'.

Page 1/1 | 1 

  • Avoid Spring ApllicationContext instanciation

    - by Ceddoc
    I use Spring 3 to make a simple configuration. I have an XML file called PropertyBeans.xml like that : <bean id="propertyBean" class="com.myapp.PropertyBean"> <property name="rootDirLogPath" value="C:\Users\dede" /> </bean> I have the bean which match this XML and then I want to use this bean with the value injected. Actually I have : ApplicationContext context = new ClassPathXmlApplicationContext("AppPropertyBeans.xml"); PropertyBean obj = (PropertyBean) context.getBean("propertyBean"); String rootDirLogPath = obj.getRootDirLogPath(); This works great but I want to know if there's a way to avoid the instantiation of ApplicationContext at each time I want to use a bean. I've heard about BeanFactory is that a good idea? Which are the others solutions? In other words: Am I supposed to called this Application context instanciation in every Controller in spring MVC?

    Read the article

1