实现GenericFilterBean的initFilterBean(),对Rose初始化,在此对比启动日志和分析框架源码
[INFO 2016-08-22 18:25:04.852] [resin-48] [] [RoseFilter.initFilterBean] [[init] call 'init/rootContext'] [DEBUG 2016-08-22 18:25:04.853] [resin-48] [] [RoseFilter.initFilterBean] [[init] parameters: ]
准备上下文环境 prepareRootApplicationContext()--创建根级别的ApplicationContext对象,比如WEB-INF、WEB-INF/classes
jar中的spring配置文件所组成代表的、整合为一个 ApplicationContext 对象
[INFO 2016-08-22 18:25:04.853] [resin-48] [] [RoseFilter.prepareRootApplicationContext] [[init/rootContext] starting ...]
当前存在servletContext,如果是RoseWebAppContext,[init/rootContext] the root context exists,直接return;
当前存在servletContext,不是RoseWebAppContex 否则启动失败,报错Cannot initialize context because there is already a root application context present,检查web.xml
确认所使用的applicationContext配置,默认使用
public static final String DEFAULT_CONFIG_LOCATION = "/WEB-INF/applicationContext*.xml";
设置servletContext
[INFO 2016-08-22 18:25:13.496] [resin-48] [] [RoseFilter.prepareRootApplicationContext] [[init/rootContext] exits] [INFO 2016-08-22 18:25:13.496] [resin-48] [] [RoseFilter.prepareRootApplicationContext] [[init/rootContext] Published rose.root WebApplicationContext [rose.root: display name [Root WebApplicationContext]; startup date [Mon Aug 22 18:25:04 CST 2016]; root of context hierarchy] as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]]
[INFO 2016-08-22 18:25:13.496] [resin-48] [] [RoseFilter.initFilterBean] [[init] exits from 'init/rootContext'] [INFO 2016-08-22 18:25:13.496] [resin-48] [] [RoseFilter.initFilterBean] [[init] call 'init/module']
识别rose程序模块 prepareModules(rootContext)
[INFO 2016-08-22 18:25:23.164] [resin-48] [] [RoseFilter.initFilterBean] [[init] exits from 'init/module'] [INFO 2016-08-22 18:25:23.164] [resin-48] [] [RoseFilter.initFilterBean] [[init] call 'init/mappingTree']
创建匹配树以及各个节点上的执行逻辑 prepareMappingTree(modules)
[INFO 2016-08-22 18:25:23.416] [resin-48] [] [RoseFilter.initFilterBean] [[init] exits from 'init/mappingTree'] [INFO 2016-08-22 18:25:23.416] [resin-48] [] [RoseFilter.initFilterBean] [[init] exits from 'init']
打印启动信息printRoseInfos(endTime - startTime)