Spring has the following three main types of application contexts:
Classpathxmlapplicationcontext (Org.springframework.context.support.ClassPathXmlApplicationContext)-- Loads the context definition from the XML configuration file under the Classpath to treat the application context definition file as a class resource.
Filesystemxmlapplicationcontext (Org.springframework.context.support.FileSystemXmlApplicationContext)-- Reads the XML configuration file under the file system and loads the context definition.
Xmlwebapplicationcontext (Org.springframework.web.context.support.XmlWebApplicationContext)-- Reads the XML configuration file under the Web application and loads the context definition.
The difference between using Filesystemxmlapplicationcontext and using Classpathxmlapplicationcontext is that Filesystemxmlapplicationcontext finds the. XML text under the specified file system path. And Classpathxmlapplicationcontext is looking for an. xml file under all Classpath (including jar files).
By using an existing application context reference, you can invoke the Getbean () method of the application context to fetch the bean from the spring container.