Commits

conanca committed b454ac4

使用Ioc - 复合加载器

Comments (0)

Files changed (2)

src/main/java/com/dolplay/nutzshiro/MainModule.java

 import org.nutz.mvc.annotation.Localization;
 import org.nutz.mvc.annotation.Modules;
 import org.nutz.mvc.annotation.SetupBy;
-import org.nutz.mvc.ioc.provider.JsonIocProvider;
+import org.nutz.mvc.ioc.provider.ComboIocProvider;
 
 import com.dolplay.nutzshiro.filter.ShiroActionFilter;
 import com.dolplay.nutzshiro.module.PermissionModule;
 import com.dolplay.nutzshiro.module.UserModule;
 
 @Modules({ UserModule.class, RoleModule.class, SystemModule.class, PermissionModule.class })
-@IocBy(type = JsonIocProvider.class, args = { "ioc.js", "dao.js", "shiro.js" })
+@IocBy(type = ComboIocProvider.class, args = { "*org.nutz.ioc.loader.json.JsonLoader", "dao.js", "shiro.js",
+		"*org.nutz.ioc.loader.annotation.AnnotationIocLoader", "com.dolplay.nutzshiro" })
 @SetupBy(MvcSetup.class)
 @Fail("json")
 @Filters(@By(type = ShiroActionFilter.class))

src/main/resources/ioc.js

-var ioc = {
-		
-	systemModule : {
-		type : "com.dolplay.nutzshiro.module.SystemModule"
-	},
-
-	userService : {
-		type : "com.dolplay.nutzshiro.service.UserService",
-		args : [ {
-			refer : "dao"
-		} ]
-	},
-
-	userModule : {
-		type : "com.dolplay.nutzshiro.module.UserModule",
-		fields : {
-			userService : {
-				refer : "userService"
-			}
-		}
-	},
-
-	roleService : {
-		type : "com.dolplay.nutzshiro.service.RoleService",
-		args : [ {
-			refer : "dao"
-		} ]
-	},
-
-	roleModule : {
-		type : "com.dolplay.nutzshiro.module.RoleModule",
-		fields : {
-			roleService : {
-				refer : "roleService"
-			}
-		}
-	},
-
-	permissionService : {
-		type : "com.dolplay.nutzshiro.service.PermissionService",
-		args : [ {
-			refer : "dao"
-		} ]
-	},
-
-	permissionModule : {
-		type : "com.dolplay.nutzshiro.module.PermissionModule",
-		fields : {
-			permissionService : {
-				refer : "permissionService"
-			}
-		}
-	}
-};
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.