Example usage for org.springframework.boot.devtools.restart.classloader ClassLoaderFiles getSourceFolders

List of usage examples for org.springframework.boot.devtools.restart.classloader ClassLoaderFiles getSourceFolders

Introduction

In this page you can find the example usage for org.springframework.boot.devtools.restart.classloader ClassLoaderFiles getSourceFolders.

Prototype

public Collection<SourceFolder> getSourceFolders() 

Source Link

Document

Return all SourceFolder SourceFolders that have been added to the collection.

Usage

From source file:org.springframework.boot.devtools.restart.server.RestartServer.java

/**
 * Update the current running application with the specified {@link ClassLoaderFiles}
 * and trigger a reload./*ww  w.j  a  v a 2  s. c  om*/
 * @param files updated class loader files
 */
public void updateAndRestart(ClassLoaderFiles files) {
    Set<URL> urls = new LinkedHashSet<URL>();
    Set<URL> classLoaderUrls = getClassLoaderUrls();
    for (SourceFolder folder : files.getSourceFolders()) {
        for (Entry<String, ClassLoaderFile> entry : folder.getFilesEntrySet()) {
            for (URL url : classLoaderUrls) {
                if (updateFileSystem(url, entry.getKey(), entry.getValue())) {
                    urls.add(url);
                }
            }
        }
        urls.addAll(getMatchingUrls(classLoaderUrls, folder.getName()));
    }
    updateTimeStamp(urls);
    restart(urls, files);
}