package com.chengjf.sparkdemo;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.chengjf.sparkdemo.constants.FilterConstants;
import com.chengjf.sparkdemo.context.MyContext;
import com.chengjf.sparkdemo.filter.MyFilter;

/**
 * 系统启动初始化配置
 * 
 * @author sharp
 * @date 2015-9-3
 *
 */
public class Bootstrap {

	private static final Logger logger = LoggerFactory.getLogger(Bootstrap.class);

	public static void boot() {
		logger.debug("boot start...");
		MyContext context = new MyContext();

		initFilter();
		logger.debug("boot end...");

	}

	public static void initFilter() {

		MyFilter beforeFilter = MyContext.getContext().getBean(FilterConstants.BEFORE_FILTER, MyFilter.class);
		beforeFilter.start();

		MyFilter afterFilter = MyContext.getContext().getBean(FilterConstants.AFTER_FILTER, MyFilter.class);
		afterFilter.start();
	}
}

@@ -36,25 +36,73 @@
 ort 
-org.slf4j.Logger;
+java.util.Map;%0Aimport java.util.Map.Entry;%0Aimport java.util.Set;%0A
 %0Aimp
@@ -125,73 +125,42 @@
 gger
-Factory
 ;%0A
-%0A
 import 
-com.chengjf.sparkdemo.constants.FilterConstants;
+org.slf4j.LoggerFactory;%0A
 %0Aimp
@@ -618,28 +618,41 @@
 %0A%09%09M
-yFilter before
+ap%3CString, MyFilter%3E allMy
 Filter
+s
  = M
@@ -684,198 +684,160 @@
 Bean
-(FilterConstants.BEFORE_FILTER, MyFilter.class);%0A%09%09beforeFilter.start();%0A%0A%09%09MyFilter afterFilter = MyContext.getContext().getBean(FilterConstants.AFTER_FILTER, MyFilter.class);%0A%09%09afterFilter
+sOfType(MyFilter.class);%0A%09%09Set%3CEntry%3CString, MyFilter%3E%3E set = allMyFilters.entrySet();%0A%09%09for (Entry%3CString, MyFilter%3E entry : set) %7B%0A%09%09%09entry.getValue()
 .sta
@@ -842,13 +842,18 @@
 tart();%0A
+%09%09%7D%0A%0A
 %09%7D%0A%7D%0A

初始化配置文件中所有MyFilter类，不再一一指定初始化。