Spring容器的启动方式有两种:
1、提供ApplicationContext自己创建Spring容器
通过ClassPathApplicationContext初始化容器,加载spring.xml配置文件,然后解析配置文件,
初始化Bean,注册Bean。
2、Web项目中在web.xml中配置监听器
web容器在启动时加载ContextLoaderListener,执行initWebApplicationContext方法初始化上下
文根,即WebApplicationContext,实际上是XmlWebApplicationContext,加载配置文件并初始化Bean对象