What is difference between class path , file system?

前端 未结 3 1833
执笔经年
执笔经年 2020-12-15 22:19

I know that:

  1. ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");

    loads context definition from an XML

3条回答
  •  攒了一身酷
    2020-12-15 23:20

    • ClassPathXmlApplicationContext will read files from your classpath. They must be in classes folder of your web application or in a jar in your libfolder.

    • FileSystemXmlApplicationContext can access all your file system, for example c:/config/applicationContext.xml.

    • XmlWebApplicationContext certainly can access to files contained in your web application, but this is not the most important thing. It implements WebApplicationContext and this means that it will detect ServletContextAware beans, register custom scopes (request, session, ...) among other things.

提交回复
热议问题