Forum

Forum Navigation
You need to log in to create posts and topics.

How to perform a scan without using cache?

How can I do this?

For this purpose you must instantiate the search configuration with SearchConfig.withoutUsingCache(). E.g.:

import java.util.Collection;

import org.burningwave.core.assembler.ComponentContainer;
import org.burningwave.core.assembler.ComponentSupplier;
import org.burningwave.core.classes.ClassCriteria;
import org.burningwave.core.classes.ClassHunter;
import org.burningwave.core.classes.ClassHunter.SearchResult;
import org.burningwave.core.classes.SearchConfig;
import org.burningwave.core.io.PathHelper;
    
public class Finder {
    
    public Collection<Class<?>> find() {
        ComponentSupplier componentSupplier = ComponentContainer.getInstance();
        PathHelper pathHelper = componentSupplier.getPathHelper();
        ClassHunter classHunter = componentSupplier.getClassHunter();
        
        SearchResult searchResult = classHunter.findBy(
            SearchConfig.withoutUsingCache().addPaths(
                pathHelper.getMainClassPaths()
            ).by(
                ClassCriteria.create().allThat((cls) -> {
                    return cls.getPackage().getName().matches(".*burningwave.*");
                })
            )		
        );
        
        return searchResult.getClasses();
    }
    
}