diff --git a/core/spring-boot/src/main/java/org/springframework/boot/ApplicationInfoPropertySource.java b/core/spring-boot/src/main/java/org/springframework/boot/ApplicationInfoPropertySource.java index a4feb10f9bc..46482deabb7 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/ApplicationInfoPropertySource.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/ApplicationInfoPropertySource.java @@ -44,7 +44,7 @@ class ApplicationInfoPropertySource extends MapPropertySource implements OriginL super(NAME, getProperties(readVersion(mainClass))); } - ApplicationInfoPropertySource(String applicationVersion) { + ApplicationInfoPropertySource(@Nullable String applicationVersion) { super(NAME, getProperties(applicationVersion)); } diff --git a/core/spring-boot/src/main/java/org/springframework/boot/DefaultPropertiesPropertySource.java b/core/spring-boot/src/main/java/org/springframework/boot/DefaultPropertiesPropertySource.java index ee19df5bfa5..5b4dfb4b450 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/DefaultPropertiesPropertySource.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/DefaultPropertiesPropertySource.java @@ -69,7 +69,7 @@ public class DefaultPropertiesPropertySource extends MapPropertySource { * @param action the action used to consume the * {@link DefaultPropertiesPropertySource} */ - public static void ifNotEmpty(Map source, + public static void ifNotEmpty(@Nullable Map source, @Nullable Consumer action) { if (!CollectionUtils.isEmpty(source) && action != null) { action.accept(new DefaultPropertiesPropertySource(source)); diff --git a/core/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java b/core/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java index 5807f168a7d..8fc468fb31d 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java @@ -155,7 +155,7 @@ public class ResourceBanner implements Banner { return environment.getProperty("spring.application.version"); } - protected String getBootVersion() { + protected @Nullable String getBootVersion() { return SpringBootVersion.getVersion(); } diff --git a/core/spring-boot/src/main/java/org/springframework/boot/context/annotation/Configurations.java b/core/spring-boot/src/main/java/org/springframework/boot/context/annotation/Configurations.java index b1a642f25a4..26ac171e52b 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/context/annotation/Configurations.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/context/annotation/Configurations.java @@ -88,7 +88,7 @@ public abstract class Configurations { * @since 3.4.0 */ protected Configurations(@Nullable UnaryOperator>> sorter, Collection> classes, - Function, String> beanNameGenerator) { + @Nullable Function, String> beanNameGenerator) { Assert.notNull(classes, "'classes' must not be null"); this.sorter = (sorter != null) ? sorter : UnaryOperator.identity(); Collection> sorted = this.sorter.apply(classes); diff --git a/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataActivationContext.java b/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataActivationContext.java index 22c15a748e5..cefc7a1f58f 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataActivationContext.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataActivationContext.java @@ -52,7 +52,7 @@ class ConfigDataActivationContext { * @param cloudPlatform the cloud platform * @param profiles the profiles */ - ConfigDataActivationContext(@Nullable CloudPlatform cloudPlatform, Profiles profiles) { + ConfigDataActivationContext(@Nullable CloudPlatform cloudPlatform, @Nullable Profiles profiles) { this.cloudPlatform = cloudPlatform; this.profiles = profiles; } diff --git a/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributor.java b/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributor.java index a5e9ef3b991..4bea1170b5a 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributor.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributor.java @@ -440,9 +440,10 @@ class ConfigDataEnvironmentContributor implements Iterable propertySource = configData.getPropertySources().get(propertySourceIndex); ConfigData.Options options = configData.getOptions(propertySource); options = environmentUpdateListener.onConfigDataOptions(configData, propertySource, options); diff --git a/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessor.java b/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessor.java index d3b37d23bc5..3120313173c 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessor.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessor.java @@ -160,7 +160,7 @@ public class ConfigDataEnvironmentPostProcessor implements EnvironmentPostProces * {@link ConfigDataEnvironmentUpdateListener} that can be used to track * {@link Environment} updates. */ - public static void applyTo(ConfigurableEnvironment environment, ResourceLoader resourceLoader, + public static void applyTo(ConfigurableEnvironment environment, @Nullable ResourceLoader resourceLoader, @Nullable ConfigurableBootstrapContext bootstrapContext, Collection additionalProfiles, ConfigDataEnvironmentUpdateListener environmentUpdateListener) { DeferredLogFactory logFactory = Supplier::get; diff --git a/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataProperties.java b/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataProperties.java index fe3a5ae77d1..3727de94854 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataProperties.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataProperties.java @@ -27,6 +27,7 @@ import org.springframework.boot.context.properties.bind.Bindable; import org.springframework.boot.context.properties.bind.Binder; import org.springframework.boot.context.properties.bind.Name; import org.springframework.boot.context.properties.source.ConfigurationPropertyName; +import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; /** @@ -99,14 +100,14 @@ class ConfigDataProperties { private final @Nullable CloudPlatform onCloudPlatform; - private final String[] onProfile; + private final String @Nullable [] onProfile; /** * Create a new {@link Activate} instance. * @param onCloudPlatform the cloud platform required for activation * @param onProfile the profile expression required for activation */ - Activate(@Nullable CloudPlatform onCloudPlatform, String[] onProfile) { + Activate(@Nullable CloudPlatform onCloudPlatform, String @Nullable [] onProfile) { this.onProfile = onProfile; this.onCloudPlatform = onCloudPlatform; } @@ -137,6 +138,7 @@ class ConfigDataProperties { } private boolean matchesActiveProfiles(Predicate activeProfiles) { + Assert.state(this.onProfile != null, "'this.onProfile' must not be null"); return org.springframework.core.env.Profiles.of(this.onProfile).matches(activeProfiles); }