@Override
    public Component resolveComponent(Dependency dependency)
            throws InvalidComponentNameException, DependencyNotMeetException {
        List<Component> meets = resolveComponents(dependency);
        if (meets.isEmpty()) {
            Set<Dependency> dependencies = new HashSet<Dependency>(cache.keySet());
            for (Dependency dep : dependencies) {
                if (dependency.accept(dep)) {
                    Resource resource = cache.get(dep);
                    meets.add(resolver.resolveComponent(dependency, resource));
                    //cache.remove(dep);
                }
            }
        }
        if (meets.isEmpty()) {
            logger.trace("Can't find {} in current repository", dependency);
            throw new DependencyNotMeetException(dependency);
        }
        return meets.get(0);
    }
@Override
    public Component resolveComponent(Dependency dependency)
            throws InvalidComponentNameException, DependencyNotMeetException {
        List<Component> meets = resolveComponents(dependency);
        if (meets.isEmpty()) {
            Set<Dependency> dependencies = new HashSet<Dependency>(cache.keySet());
            for (Dependency dep : dependencies) {
                if (dependency.accept(dep)) {
                    Resource resource = cache.get(dep);
                    meets.add(resolver.resolveComponent(dependency, resource));
                    
                }
            }
        }
        if (meets.isEmpty()) {
            logger.trace("Can't find {} in current repository", dependency);
            throw new DependencyNotMeetException(dependency);
        }
        return meets.get(0);
    }
@ Override public Component resolveComponent ( Dependency dependency ) throws InvalidComponentNameException , DependencyNotMeetException { List < Component > meets = resolveComponents ( dependency ) ; if ( meets . isEmpty ( ) ) { Set < Dependency > dependencies = new HashSet < Dependency > ( cache . keySet ( ) ) ; for ( Dependency dep : dependencies ) { if ( dependency . accept ( dep ) ) { Resource resource = cache . get ( dep ) ; meets . add ( resolver . resolveComponent ( dependency , resource ) ) ; //cache.remove(dep); } } } if ( meets . isEmpty ( ) ) { logger . trace ( "Can't find {} in current repository" , dependency ) ; throw new DependencyNotMeetException ( dependency ) ; } return meets . get ( 0 ) ; }
------------------------------------------------------------
------------------------------------------------------------