Merge branch '2.7.x'

Closes gh-31178
This commit is contained in:
Andy Wilkinson
2022-05-26 15:54:58 +01:00
68 changed files with 137 additions and 166 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@@ -411,8 +411,7 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests {
}
@TestTemplate
void whenJarIsRepackagedWithOutputTimestampConfiguredThenLibrariesAreSorted(MavenBuild mavenBuild)
throws InterruptedException {
void whenJarIsRepackagedWithOutputTimestampConfiguredThenLibrariesAreSorted(MavenBuild mavenBuild) {
mavenBuild.project("jar-output-timestamp").execute((project) -> {
File repackaged = new File(project, "target/jar-output-timestamp-0.0.1.BUILD-SNAPSHOT.jar");
List<String> sortedLibs = Arrays.asList("BOOT-INF/lib/jakarta.servlet-api", "BOOT-INF/lib/spring-aop",

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@@ -113,8 +113,7 @@ class WarIntegrationTests extends AbstractArchiveIntegrationTests {
}
@TestTemplate
void whenWarIsRepackagedWithOutputTimestampConfiguredThenLibrariesAreSorted(MavenBuild mavenBuild)
throws InterruptedException {
void whenWarIsRepackagedWithOutputTimestampConfiguredThenLibrariesAreSorted(MavenBuild mavenBuild) {
mavenBuild.project("war-output-timestamp").execute((project) -> {
File repackaged = new File(project, "target/war-output-timestamp-0.0.1.BUILD-SNAPSHOT.war");
List<String> sortedLibs = Arrays.asList(

View File

@@ -153,7 +153,7 @@ public class StartMojo extends AbstractApplicationRunMojo {
}
private void doWaitForSpringApplication(MBeanServerConnection connection)
throws IOException, MojoExecutionException, MojoFailureException {
throws MojoExecutionException, MojoFailureException {
final SpringApplicationAdminClient client = new SpringApplicationAdminClient(connection, this.jmxName);
try {
execute(this.wait, this.maxAttempts, () -> (client.isReady() ? true : null));

View File

@@ -74,7 +74,8 @@ public class StopMojo extends AbstractMojo {
return;
}
getLog().info("Stopping application...");
try (JMXConnector connector = SpringApplicationAdminClient.connect(this.jmxPort)) {
try (JMXConnector connector = SpringApplicationAdminClient
.connect(this.jmxPort)) {
MBeanServerConnection connection = connector.getMBeanServerConnection();
stop(connection);
}
@@ -84,13 +85,14 @@ public class StopMojo extends AbstractMojo {
}
}
private void stop(MBeanServerConnection connection) throws IOException, MojoExecutionException {
private void stop(MBeanServerConnection connection) throws IOException, MojoExecutionException {
try {
new SpringApplicationAdminClient(connection, this.jmxName).stop();
}
catch (InstanceNotFoundException ex) {
throw new MojoExecutionException(
"Spring application lifecycle JMX bean not found. Could not stop application gracefully", ex);
"Spring application lifecycle JMX bean not found. Could not stop application gracefully",
ex);
}
}