aspose file tools*
The moose likes Spring and the fly likes When to use different ways to load config files in spring??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "When to use different ways to load config files in spring???" Watch "When to use different ways to load config files in spring???" New topic
Author

When to use different ways to load config files in spring???

kandy pal
Greenhorn

Joined: Mar 15, 2013
Posts: 1
Hi All,

I am new to Spring. I have query regarding the ways to load the config file in spring.

What is the difference between

ApplicationContext context = new ClassPathXmlApplicationContext("AppConfig.xml");

And

Resource res = new ClassPathResource("spconfig.xml");
BeanFactory factory = new XmlBeanFactory(res);

Thanks
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1649
    
    7

BeanFactory should rarely if ever be used in application code with modern versions of Spring. If you are loading a context XML in a standalone Spring application then you should use the first approach.


[How To Ask Questions][Read before you PM me]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: When to use different ways to load config files in spring???