Search code examples
springapplicationcontext

How to change application context


To begin with, I have to say that I'm totally new in spring, my first task was to change application context. I think it should be placed in *.xml files, but can' find the field. I've google it as well, but didn' find any solution. Probably poor searcher :(.


Solution

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

    It will load the context from context.xml file (context.xml should be present in classpath).
    You can create new Applicationcontext by passing desired XML file as parameter to constructor.