LayerResolver Class — spring-boot Architecture
Architecture documentation for the LayerResolver class in LayerResolver.java from the spring-boot codebase.
Entity Profile
Source Code
build-plugin/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LayerResolver.java lines 40–90
class LayerResolver {
private final ResolvedDependencies resolvedDependencies;
private final LayeredSpec layeredConfiguration;
private final Spec<FileCopyDetails> librarySpec;
LayerResolver(ResolvedDependencies resolvedDependencies, LayeredSpec layeredConfiguration,
Spec<FileCopyDetails> librarySpec) {
this.resolvedDependencies = resolvedDependencies;
this.layeredConfiguration = layeredConfiguration;
this.librarySpec = librarySpec;
}
@Nullable Layer getLayer(FileCopyDetails details) {
try {
if (this.librarySpec.isSatisfiedBy(details)) {
return getLayer(asLibrary(details));
}
return getLayer(details.getSourcePath());
}
catch (UnsupportedOperationException ex) {
return null;
}
}
Layer getLayer(Library library) {
return this.layeredConfiguration.asLayers().getLayer(library);
}
Layer getLayer(String applicationResource) {
return this.layeredConfiguration.asLayers().getLayer(applicationResource);
}
Iterable<Layer> getLayers() {
return this.layeredConfiguration.asLayers();
}
private Library asLibrary(FileCopyDetails details) {
File file = details.getFile();
DependencyDescriptor dependency = this.resolvedDependencies.find(file);
if (dependency == null) {
return new Library(null, file, null, null, false, false, true);
}
LibraryCoordinates coordinates = dependency.getCoordinates();
boolean projectDependency = dependency.isProjectDependency();
return new Library(null, file, null, coordinates, false, projectDependency, true);
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free