src/org/nutz/resource/Scans.java
public Scans init(final ServletContext sc) {
	    Stopwatch sw = Stopwatch.begin();
        // 获取classes文件夹的路径, 优先级为125
	    String classesPath = sc.getRealPath("/WEB-INF/classes");
	    if (classesPath == null)
	        addResourceLocation(new WebClassesResourceLocation(sc));
	    else {
	        ResourceLocation rc = ResourceLocation.file(new File(classesPath));
	        if (rc instanceof FileSystemResourceLocation)
	            ((FileSystemResourceLocation)rc).priority = 125;
	        addResourceLocation(rc);
	    }

        // 获取lib文件夹中的全部jar, 优先级是50
        Set<String> jars = sc.getResourcePaths("/WEB-INF/lib/");
        if (jars != null) {// 这个文件夹不一定存在,尤其是Maven的WebApp项目
            for (String path : jars) {
                if (!path.endsWith(".jar"))
                    continue;
                try {
                    addResourceLocation(new JarResourceLocation(sc.getResource(path)));
                }
                catch (Exception e) {
                    log.debug("parse jar fail >> " + e.getMessage());
                }
            }
        }
        sw.stop();
        printLocations(sw);
        return this;
    }
public Scans init(final ServletContext sc) {
	    Stopwatch sw = Stopwatch.begin();
        // 获取classes文件夹的路径, 优先级为125
	    String classesPath = sc.getRealPath("/WEB-INF/classes");
	    if (classesPath == null)
	        addResourceLocation(new WebClassesResourceLocation(sc));
	    else {
	        ResourceLocation rc = ResourceLocation.file(new File(classesPath));
	        if (rc instanceof FileSystemResourceLocation)
	            ((FileSystemResourceLocation)rc).priority = 125;
	        addResourceLocation(rc);
	    }

        // 获取lib文件夹中的全部jar, 优先级是50
        Set<String> jars = sc.getResourcePaths("/WEB-INF/lib/");
        if (jars != null) {// 这个文件夹不一定存在,尤其是Maven的WebApp项目
            for (String path : jars) {
                if (!path.endsWith(".jar"))
                    continue;
                try {
                    addResourceLocation(new JarResourceLocation(sc.getResource(path)));
                }
                catch (Exception e) {
                    log.debug("parse jar fail >> " + e.getMessage());
                }
            }
        }
        sw.stop();
        printLocations(sw);
        return this;
    }
在Web环境中使用Nutz的任何功能,都应该先调用这个方法,以初始化资源扫描器
<p/>
调用一次就可以了