mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Merge branch '3.2.x'
Closes gh-40701
This commit is contained in:
commit
d98987f11e
@ -25,6 +25,7 @@ import java.util.Set;
|
||||
|
||||
import org.springframework.boot.actuate.endpoint.Show;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* Properties used to configure the health endpoint and endpoint groups.
|
||||
@ -92,7 +93,7 @@ public abstract class HealthProperties {
|
||||
}
|
||||
|
||||
public void setOrder(List<String> statusOrder) {
|
||||
if (statusOrder != null && !statusOrder.isEmpty()) {
|
||||
if (!CollectionUtils.isEmpty(statusOrder)) {
|
||||
this.order = statusOrder;
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import java.util.List;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@ -388,7 +389,7 @@ public final class ConditionMessage {
|
||||
else if (StringUtils.hasLength(this.plural)) {
|
||||
message.append(" ").append(this.plural);
|
||||
}
|
||||
if (items != null && !items.isEmpty()) {
|
||||
if (!CollectionUtils.isEmpty(items)) {
|
||||
message.append(" ").append(StringUtils.collectionToDelimitedString(items, ", "));
|
||||
}
|
||||
return this.condition.because(message.toString());
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.boot.buildpack.platform.build;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Exception thrown to indicate a Builder error.
|
||||
*
|
||||
@ -52,7 +54,7 @@ public class BuilderException extends RuntimeException {
|
||||
|
||||
private static String buildMessage(String operation, int statusCode) {
|
||||
StringBuilder message = new StringBuilder("Builder");
|
||||
if (operation != null && !operation.isEmpty()) {
|
||||
if (StringUtils.hasLength(operation)) {
|
||||
message.append(" lifecycle '").append(operation).append("'");
|
||||
}
|
||||
message.append(" failed with status code ").append(statusCode);
|
||||
|
@ -25,6 +25,7 @@ import org.springframework.boot.buildpack.platform.docker.type.ImageReference;
|
||||
import org.springframework.boot.buildpack.platform.docker.type.Layer;
|
||||
import org.springframework.boot.buildpack.platform.io.Content;
|
||||
import org.springframework.boot.buildpack.platform.io.Owner;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* A short-lived builder that is created for each {@link Lifecycle} run.
|
||||
@ -66,7 +67,7 @@ class EphemeralBuilder {
|
||||
update.withUpdatedConfig(this.builderMetadata::attachTo);
|
||||
update.withUpdatedConfig((config) -> config.withLabel(BUILDER_FOR_LABEL_NAME, targetImage.toString()));
|
||||
update.withTag(name);
|
||||
if (env != null && !env.isEmpty()) {
|
||||
if (!CollectionUtils.isEmpty(env)) {
|
||||
update.withNewLayer(getEnvLayer(env));
|
||||
}
|
||||
if (buildpacks != null) {
|
||||
|
@ -19,6 +19,8 @@ package org.springframework.boot.buildpack.platform.docker;
|
||||
import java.io.PrintStream;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Utility to render a simple progress bar based on consumed {@link TotalProgressEvent}
|
||||
* objects.
|
||||
@ -63,7 +65,7 @@ public class TotalProgressBar implements Consumer<TotalProgressEvent> {
|
||||
public TotalProgressBar(String prefix, char progressChar, boolean bookend, PrintStream out) {
|
||||
this.progressChar = progressChar;
|
||||
this.bookend = bookend;
|
||||
if (prefix != null && !prefix.isEmpty()) {
|
||||
if (StringUtils.hasLength(prefix)) {
|
||||
out.print(prefix);
|
||||
out.print(" ");
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.springframework.boot.buildpack.platform.json.SharedObjectMapper;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StreamUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@ -71,7 +72,7 @@ public class ContainerConfig {
|
||||
}
|
||||
ArrayNode bindsNode = hostConfigNode.putArray("Binds");
|
||||
bindings.forEach((binding) -> bindsNode.add(binding.toString()));
|
||||
if (securityOptions != null && !securityOptions.isEmpty()) {
|
||||
if (!CollectionUtils.isEmpty(securityOptions)) {
|
||||
ArrayNode securityOptsNode = hostConfigNode.putArray("SecurityOpt");
|
||||
securityOptions.forEach(securityOptsNode::add);
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ import org.springframework.boot.buildpack.platform.docker.type.ImageName;
|
||||
import org.springframework.boot.buildpack.platform.docker.type.ImageReference;
|
||||
import org.springframework.boot.buildpack.platform.io.ZipFileTarArchive;
|
||||
import org.springframework.boot.gradle.util.VersionExtractor;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@ -382,7 +383,7 @@ public abstract class BootBuildImage extends DefaultTask {
|
||||
|
||||
private BuildRequest customizeEnvironment(BuildRequest request) {
|
||||
Map<String, String> environment = getEnvironment().getOrNull();
|
||||
if (environment != null && !environment.isEmpty()) {
|
||||
if (!CollectionUtils.isEmpty(environment)) {
|
||||
request = request.withEnv(environment);
|
||||
}
|
||||
return request;
|
||||
@ -411,7 +412,7 @@ public abstract class BootBuildImage extends DefaultTask {
|
||||
|
||||
private BuildRequest customizeBuildpacks(BuildRequest request) {
|
||||
List<String> buildpacks = getBuildpacks().getOrNull();
|
||||
if (buildpacks != null && !buildpacks.isEmpty()) {
|
||||
if (!CollectionUtils.isEmpty(buildpacks)) {
|
||||
return request.withBuildpacks(buildpacks.stream().map(BuildpackReference::of).toList());
|
||||
}
|
||||
return request;
|
||||
@ -419,7 +420,7 @@ public abstract class BootBuildImage extends DefaultTask {
|
||||
|
||||
private BuildRequest customizeBindings(BuildRequest request) {
|
||||
List<String> bindings = getBindings().getOrNull();
|
||||
if (bindings != null && !bindings.isEmpty()) {
|
||||
if (!CollectionUtils.isEmpty(bindings)) {
|
||||
return request.withBindings(bindings.stream().map(Binding::of).toList());
|
||||
}
|
||||
return request;
|
||||
@ -427,7 +428,7 @@ public abstract class BootBuildImage extends DefaultTask {
|
||||
|
||||
private BuildRequest customizeTags(BuildRequest request) {
|
||||
List<String> tags = getTags().getOrNull();
|
||||
if (tags != null && !tags.isEmpty()) {
|
||||
if (!CollectionUtils.isEmpty(tags)) {
|
||||
return request.withTags(tags.stream().map(ImageReference::of).toList());
|
||||
}
|
||||
return request;
|
||||
|
@ -30,6 +30,8 @@ import org.gradle.api.tasks.PathSensitive;
|
||||
import org.gradle.api.tasks.PathSensitivity;
|
||||
import org.gradle.api.tasks.bundling.AbstractArchiveTask;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Encapsulates the configuration of the launch script for an executable jar or war.
|
||||
*
|
||||
@ -111,7 +113,7 @@ public class LaunchScriptConfiguration implements Serializable {
|
||||
private void putIfMissing(Map<String, String> properties, String key, String... valueCandidates) {
|
||||
if (!properties.containsKey(key)) {
|
||||
for (String candidate : valueCandidates) {
|
||||
if (candidate != null && !candidate.isEmpty()) {
|
||||
if (StringUtils.hasLength(candidate)) {
|
||||
properties.put(key, candidate);
|
||||
return;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ import org.springframework.boot.loader.tools.LayoutFactory;
|
||||
import org.springframework.boot.loader.tools.Libraries;
|
||||
import org.springframework.boot.loader.tools.LoaderImplementation;
|
||||
import org.springframework.boot.loader.tools.Repackager;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Repackage existing JAR and WAR archives so that they can be executed from the command
|
||||
@ -271,7 +272,7 @@ public class RepackageMojo extends AbstractPackagerMojo {
|
||||
private void putIfMissing(Properties properties, String key, String... valueCandidates) {
|
||||
if (!properties.containsKey(key)) {
|
||||
for (String candidate : valueCandidates) {
|
||||
if (candidate != null && !candidate.isEmpty()) {
|
||||
if (StringUtils.hasLength(candidate)) {
|
||||
properties.put(key, candidate);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user