wood burning stoves 2.0*
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: 1648
    
    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]
 
Don't get me started about those stupid light bulbs.
 
subject: When to use different ways to load config files in spring???
 
Similar Threads
Help? - Reloading log4j.xml config without jboss restart
ClassPathXmlApplicationContext wildcard problem
what is diff in Spring's ClassPathResource and FileSystemResource class
spring
Loading the Bean in two different ways