getResources() — spring-boot Function Reference
Architecture documentation for the getResources() function in LocationResourceLoader.java from the spring-boot codebase.
Entity Profile
Dependency Diagram
graph TD 513f1438_c988_7573_e693_4e5e95b0dd80["getResources()"] dc275f22_dc4e_a38d_0beb_87529a6fc2ae["validatePattern()"] 513f1438_c988_7573_e693_4e5e95b0dd80 -->|calls| dc275f22_dc4e_a38d_0beb_87529a6fc2ae e6532b20_39af_4d6f_f097_fa28368a9655["getResource()"] 513f1438_c988_7573_e693_4e5e95b0dd80 -->|calls| e6532b20_39af_4d6f_f097_fa28368a9655 12d4ef93_bb92_2e96_af1f_6ec25cf5f72d["getFile()"] 513f1438_c988_7573_e693_4e5e95b0dd80 -->|calls| 12d4ef93_bb92_2e96_af1f_6ec25cf5f72d style 513f1438_c988_7573_e693_4e5e95b0dd80 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
core/spring-boot/src/main/java/org/springframework/boot/context/config/LocationResourceLoader.java lines 94–124
Resource[] getResources(String location, ResourceType type) {
validatePattern(location, type);
String directoryPath = location.substring(0, location.indexOf("*/"));
String fileName = location.substring(location.lastIndexOf("/") + 1);
Resource resource = getResource(directoryPath);
if (!resource.exists()) {
return EMPTY_RESOURCES;
}
File file = getFile(location, resource);
if (!file.isDirectory()) {
return EMPTY_RESOURCES;
}
File[] subDirectories = file.listFiles(this::isVisibleDirectory);
if (subDirectories == null) {
return EMPTY_RESOURCES;
}
Arrays.sort(subDirectories, FILE_PATH_COMPARATOR);
if (type == ResourceType.DIRECTORY) {
return Arrays.stream(subDirectories).map(FileSystemResource::new).toArray(Resource[]::new);
}
List<Resource> resources = new ArrayList<>();
FilenameFilter filter = (dir, name) -> name.equals(fileName);
for (File subDirectory : subDirectories) {
File[] files = subDirectory.listFiles(filter);
if (files != null) {
Arrays.sort(files, FILE_NAME_COMPARATOR);
Arrays.stream(files).map(FileSystemResource::new).forEach(resources::add);
}
}
return resources.toArray(EMPTY_RESOURCES);
}
Domain
Subdomains
Calls
- getFile()
- getResource()
- validatePattern()
Source
Frequently Asked Questions
What does getResources() do?
getResources() is a function in the spring-boot codebase.
What does getResources() call?
getResources() calls 3 function(s): getFile, getResource, validatePattern.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free