ソースを参照

InterceptorStack add inject

James 5 年 前
コミット
280aed0ea7
1 ファイル変更10 行追加4 行削除
  1. 10 4
      src/main/java/com/jfinal/aop/InterceptorStack.java

+ 10 - 4
src/main/java/com/jfinal/aop/InterceptorStack.java

@@ -38,15 +38,21 @@ public abstract class InterceptorStack implements Interceptor {
 		interList = null;
 	}
 	
-	protected final InterceptorStack addInterceptors(Interceptor... interceptors) {
-		if (interceptors == null || interceptors.length == 0)
+	protected InterceptorStack addInterceptors(Interceptor... interceptors) {
+		if (interceptors == null || interceptors.length == 0) {
 			throw new IllegalArgumentException("Interceptors can not be null");
+		}
 		
-		if (interList == null)
+		if (interList == null) {
 			interList = new ArrayList<Interceptor>();
+		}
 		
-		for (Interceptor ref : interceptors)
+		for (Interceptor ref : interceptors) {
+			if (AopManager.me().isInjectDependency()) {
+				Aop.inject(ref);
+			}
 			interList.add(ref);
+		}
 		
 		return this;
 	}