mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Merge branch '3.5.x' into 4.0.x
Closes gh-50297
This commit is contained in:
@@ -70,6 +70,19 @@ tasks.register("buildSignedJarApp", GradleBuild) {
|
||||
tasks = ["build"]
|
||||
}
|
||||
|
||||
tasks.register("syncSignedJarRsaAppSource", org.springframework.boot.build.SyncAppSource) {
|
||||
sourceDirectory = file("spring-boot-loader-tests-signed-jar-rsa")
|
||||
destinationDirectory = file(layout.buildDirectory.dir("spring-boot-loader-tests-signed-jar-rsa"))
|
||||
}
|
||||
|
||||
tasks.register("buildSignedJarRsaApp", GradleBuild) {
|
||||
dependsOn syncSignedJarRsaAppSource, syncMavenRepository
|
||||
dir = layout.buildDirectory.dir("spring-boot-loader-tests-signed-jar-rsa")
|
||||
startParameter.buildCacheEnabled = false
|
||||
tasks = ["build"]
|
||||
}
|
||||
|
||||
|
||||
tasks.register("downloadJdk", Download) {
|
||||
def destFolder = new File(project.gradle.gradleUserHomeDir, "caches/springboot/downloads/jdk/oracle")
|
||||
destFolder.mkdirs()
|
||||
@@ -92,5 +105,5 @@ tasks.named("processDockerTestResources").configure {
|
||||
}
|
||||
|
||||
tasks.named("dockerTest").configure {
|
||||
dependsOn buildApp, buildSignedJarApp
|
||||
dependsOn buildApp, buildSignedJarApp, buildSignedJarRsaApp
|
||||
}
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2012-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.springframework.boot.gradle.tasks.bundling.BootJar
|
||||
|
||||
plugins {
|
||||
id "java"
|
||||
id "org.springframework.boot"
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = '17'
|
||||
targetCompatibility = '17'
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url "file:${rootDir}/../docker-test-maven-repository"}
|
||||
mavenCentral()
|
||||
spring.mavenRepositories()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
|
||||
implementation("org.springframework.boot:spring-boot-starter")
|
||||
implementation("org.bouncycastle:bcprov-jdk18on:1.84") // gh-50292
|
||||
}
|
||||
|
||||
tasks.register("bootJarUnpack", BootJar.class) {
|
||||
mainClass = "org.springframework.boot.loaderapp.LoaderSignedJarTestApplication"
|
||||
classpath = bootJar.classpath
|
||||
requiresUnpack '**/bcprov-jdk18on-*.jar'
|
||||
archiveClassifier.set("unpack")
|
||||
targetJavaVersion = targetCompatibility
|
||||
}
|
||||
|
||||
build.dependsOn bootJarUnpack
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2012-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
pluginManagement {
|
||||
evaluate(new File("${gradle.parent.rootProject.rootDir}/buildSrc/SpringRepositorySupport.groovy")).apply(this)
|
||||
repositories {
|
||||
maven { url "file:${rootDir}/../docker-test-maven-repository"}
|
||||
mavenCentral()
|
||||
spring.mavenRepositories()
|
||||
}
|
||||
resolutionStrategy {
|
||||
eachPlugin {
|
||||
if (requested.id.id == "org.springframework.boot") {
|
||||
useModule "org.springframework.boot:spring-boot-gradle-plugin:${requested.version}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2012-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.loaderapp;
|
||||
|
||||
import java.security.Security;
|
||||
import javax.crypto.Cipher;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class LoaderSignedJarTestApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
Cipher.getInstance("AES/CBC/PKCS5Padding","BC");
|
||||
System.out.println("Legion of the Bouncy Castle");
|
||||
SpringApplication.run(LoaderSignedJarTestApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -85,6 +85,17 @@ class LoaderIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("javaRuntimes")
|
||||
void runSignedJarWhenRsa(JavaRuntime javaRuntime) {
|
||||
try (GenericContainer<?> container = createContainer(javaRuntime, "spring-boot-loader-tests-signed-jar-rsa",
|
||||
null)) {
|
||||
container.start();
|
||||
System.out.println(this.output.toUtf8String());
|
||||
assertThat(this.output.toUtf8String()).contains("Legion of the Bouncy Castle");
|
||||
}
|
||||
}
|
||||
|
||||
private GenericContainer<?> createContainer(JavaRuntime javaRuntime, String name, String classifier) {
|
||||
return javaRuntime.getContainer()
|
||||
.withLogConsumer(this.output)
|
||||
|
||||
Reference in New Issue
Block a user