Home / Function/ implicitLayers() — spring-boot Function Reference

implicitLayers() — spring-boot Function Reference

Architecture documentation for the implicitLayers() function in AbstractBootArchiveIntegrationTests.java from the spring-boot codebase.

Entity Profile

Dependency Diagram

graph TD
  1480e02e_7f37_b733_2059_24a17cfcd2ae["implicitLayers()"]
  c1d87296_7b81_712e_cfb5_8a0a1fef6968["writeMainClass()"]
  1480e02e_7f37_b733_2059_24a17cfcd2ae -->|calls| c1d87296_7b81_712e_cfb5_8a0a1fef6968
  2537bd26_f68f_0773_f0ef_19e3a06ef3b7["writeResource()"]
  1480e02e_7f37_b733_2059_24a17cfcd2ae -->|calls| 2537bd26_f68f_0773_f0ef_19e3a06ef3b7
  4411a1be_530d_c0d4_e4d4_669711600b98["readLayerIndex()"]
  1480e02e_7f37_b733_2059_24a17cfcd2ae -->|calls| 4411a1be_530d_c0d4_e4d4_669711600b98
  c312f8db_dbba_3214_8e81_013a94f3f3ca["getExpectedApplicationLayerContents()"]
  1480e02e_7f37_b733_2059_24a17cfcd2ae -->|calls| c312f8db_dbba_3214_8e81_013a94f3f3ca
  f135ea13_1496_d12c_baa5_7d8c5094e579["assertExtractedLayers()"]
  1480e02e_7f37_b733_2059_24a17cfcd2ae -->|calls| f135ea13_1496_d12c_baa5_7d8c5094e579
  style 1480e02e_7f37_b733_2059_24a17cfcd2ae fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java lines 328–380

	@TestTemplate
	void implicitLayers() throws IOException {
		writeMainClass();
		writeResource();
		BuildTask task = this.gradleBuild.build(this.taskName).task(":" + this.taskName);
		assertThat(task).isNotNull();
		assertThat(task.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
		Map<String, List<String>> indexedLayers;
		String toolsJar = this.libPath + JarModeLibrary.TOOLS.getName();
		try (JarFile jarFile = new JarFile(new File(this.gradleBuild.getProjectDir(), "build/libs").listFiles()[0])) {
			assertThat(jarFile.getEntry(toolsJar)).isNotNull();
			assertThat(jarFile.getEntry(this.libPath + "commons-lang3-3.9.jar")).isNotNull();
			assertThat(jarFile.getEntry(this.libPath + "spring-core-5.2.5.RELEASE.jar")).isNotNull();
			assertThat(jarFile.getEntry(this.libPath + "spring-jcl-5.2.5.RELEASE.jar")).isNotNull();
			assertThat(jarFile.getEntry(this.libPath + "library-1.0-SNAPSHOT.jar")).isNotNull();
			assertThat(jarFile.getEntry(this.classesPath + "example/Main.class")).isNotNull();
			assertThat(jarFile.getEntry(this.classesPath + "static/file.txt")).isNotNull();
			indexedLayers = readLayerIndex(jarFile);
		}
		List<String> layerNames = Arrays.asList("dependencies", "spring-boot-loader", "snapshot-dependencies",
				"application");
		assertThat(indexedLayers.keySet()).containsExactlyElementsOf(layerNames);
		Set<String> expectedDependencies = new TreeSet<>();
		expectedDependencies.add(this.libPath + "commons-lang3-3.9.jar");
		expectedDependencies.add(this.libPath + "spring-core-5.2.5.RELEASE.jar");
		expectedDependencies.add(this.libPath + "spring-jcl-5.2.5.RELEASE.jar");
		expectedDependencies.add(this.libPath + "jul-to-slf4j-1.7.28.jar");
		expectedDependencies.add(this.libPath + "log4j-api-2.12.1.jar");
		expectedDependencies.add(this.libPath + "log4j-to-slf4j-2.12.1.jar");
		expectedDependencies.add(this.libPath + "logback-classic-1.2.3.jar");
		expectedDependencies.add(this.libPath + "logback-core-1.2.3.jar");
		expectedDependencies.add(this.libPath + "slf4j-api-1.7.28.jar");
		expectedDependencies.add(this.libPath + "spring-boot-starter-logging-2.2.0.RELEASE.jar");
		Set<String> expectedSnapshotDependencies = new TreeSet<>();
		expectedSnapshotDependencies.add(this.libPath + "library-1.0-SNAPSHOT.jar");
		(toolsJar.contains("SNAPSHOT") ? expectedSnapshotDependencies : expectedDependencies).add(toolsJar);
		assertThat(indexedLayers.get("dependencies")).containsExactlyElementsOf(expectedDependencies);
		assertThat(indexedLayers.get("spring-boot-loader")).containsExactly("org/");
		assertThat(indexedLayers.get("snapshot-dependencies")).containsExactlyElementsOf(expectedSnapshotDependencies);
		assertThat(indexedLayers.get("application"))
			.containsExactly(getExpectedApplicationLayerContents(this.classesPath));
		BuildResult listLayers = this.gradleBuild.build("listLayers");
		task = listLayers.task(":listLayers");
		assertThat(task).isNotNull();
		assertThat(task.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
		String listLayersOutput = listLayers.getOutput();
		assertThat(new BufferedReader(new StringReader(listLayersOutput)).lines()).containsSequence(layerNames);
		BuildResult extractLayers = this.gradleBuild.build("extractLayers");
		task = extractLayers.task(":extractLayers");
		assertThat(task).isNotNull();
		assertThat(task.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
		assertExtractedLayers(layerNames, indexedLayers);
	}

Domain

Subdomains

Frequently Asked Questions

What does implicitLayers() do?
implicitLayers() is a function in the spring-boot codebase.
What does implicitLayers() call?
implicitLayers() calls 5 function(s): assertExtractedLayers, getExpectedApplicationLayerContents, readLayerIndex, writeMainClass, writeResource.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free