buildConsumerProperties() {
- return buildConsumerProperties(null);
- }
-
/**
* Create an initial map of consumer properties from the state of this instance.
*
@@ -206,21 +191,6 @@ public class KafkaProperties {
return properties;
}
- /**
- * Create an initial map of producer properties from the state of this instance.
- *
- * This allows you to add additional properties, if necessary, and override the
- * default {@code kafkaProducerFactory} bean.
- * @return the producer properties initialized with the customizations defined on this
- * instance
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of
- * {@link #buildProducerProperties(SslBundles)}}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public Map buildProducerProperties() {
- return buildProducerProperties(null);
- }
-
/**
* Create an initial map of producer properties from the state of this instance.
*
@@ -236,21 +206,6 @@ public class KafkaProperties {
return properties;
}
- /**
- * Create an initial map of admin properties from the state of this instance.
- *
- * This allows you to add additional properties, if necessary, and override the
- * default {@code kafkaAdmin} bean.
- * @return the admin properties initialized with the customizations defined on this
- * instance
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of
- * {@link #buildAdminProperties(SslBundles)}}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public Map buildAdminProperties() {
- return buildAdminProperties(null);
- }
-
/**
* Create an initial map of admin properties from the state of this instance.
*
@@ -266,20 +221,6 @@ public class KafkaProperties {
return properties;
}
- /**
- * Create an initial map of streams properties from the state of this instance.
- *
- * This allows you to add additional properties, if necessary.
- * @return the streams properties initialized with the customizations defined on this
- * instance
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of
- * {@link #buildStreamsProperties(SslBundles)}}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public Map buildStreamsProperties() {
- return buildStreamsProperties(null);
- }
-
/**
* Create an initial map of streams properties from the state of this instance.
*
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java
index 4117f01555c..3916e51929d 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java
@@ -95,8 +95,7 @@ public abstract class JpaBaseConfiguration {
public PlatformTransactionManager transactionManager(
ObjectProvider transactionManagerCustomizers) {
JpaTransactionManager transactionManager = new JpaTransactionManager();
- transactionManagerCustomizers
- .ifAvailable((customizers) -> customizers.customize((TransactionManager) transactionManager));
+ transactionManagerCustomizers.ifAvailable((customizers) -> customizers.customize(transactionManager));
return transactionManager;
}
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java
index 829f7c0bfc3..b1faadcd8c1 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java
@@ -36,7 +36,6 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@AutoConfiguration
@EnableConfigurationProperties(TaskExecutionProperties.class)
@Import({ TaskExecutorConfigurations.ThreadPoolTaskExecutorBuilderConfiguration.class,
- TaskExecutorConfigurations.TaskExecutorBuilderConfiguration.class,
TaskExecutorConfigurations.SimpleAsyncTaskExecutorBuilderConfiguration.class,
TaskExecutorConfigurations.TaskExecutorConfiguration.class })
public class TaskExecutionAutoConfiguration {
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutorConfigurations.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutorConfigurations.java
index 9e46e106391..b8c2758ca1d 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutorConfigurations.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutorConfigurations.java
@@ -24,8 +24,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnThreading;
import org.springframework.boot.autoconfigure.thread.Threading;
import org.springframework.boot.task.SimpleAsyncTaskExecutorBuilder;
import org.springframework.boot.task.SimpleAsyncTaskExecutorCustomizer;
-import org.springframework.boot.task.TaskExecutorBuilder;
-import org.springframework.boot.task.TaskExecutorCustomizer;
import org.springframework.boot.task.ThreadPoolTaskExecutorBuilder;
import org.springframework.boot.task.ThreadPoolTaskExecutorCustomizer;
import org.springframework.context.annotation.Bean;
@@ -49,7 +47,6 @@ class TaskExecutorConfigurations {
@Configuration(proxyBeanMethods = false)
@ConditionalOnMissingBean(Executor.class)
- @SuppressWarnings("removal")
static class TaskExecutorConfiguration {
@Bean(name = { TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME,
@@ -63,55 +60,19 @@ class TaskExecutorConfigurations {
@Bean(name = { TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME,
AsyncAnnotationBeanPostProcessor.DEFAULT_TASK_EXECUTOR_BEAN_NAME })
@ConditionalOnThreading(Threading.PLATFORM)
- ThreadPoolTaskExecutor applicationTaskExecutor(TaskExecutorBuilder taskExecutorBuilder,
- ObjectProvider threadPoolTaskExecutorBuilderProvider) {
- ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder = threadPoolTaskExecutorBuilderProvider
- .getIfUnique();
- if (threadPoolTaskExecutorBuilder != null) {
- return threadPoolTaskExecutorBuilder.build();
- }
- return taskExecutorBuilder.build();
- }
-
- }
-
- @Configuration(proxyBeanMethods = false)
- @SuppressWarnings("removal")
- static class TaskExecutorBuilderConfiguration {
-
- @Bean
- @ConditionalOnMissingBean
- @Deprecated(since = "3.2.0", forRemoval = true)
- TaskExecutorBuilder taskExecutorBuilder(TaskExecutionProperties properties,
- ObjectProvider taskExecutorCustomizers,
- ObjectProvider taskDecorator) {
- TaskExecutionProperties.Pool pool = properties.getPool();
- TaskExecutorBuilder builder = new TaskExecutorBuilder();
- builder = builder.queueCapacity(pool.getQueueCapacity());
- builder = builder.corePoolSize(pool.getCoreSize());
- builder = builder.maxPoolSize(pool.getMaxSize());
- builder = builder.allowCoreThreadTimeOut(pool.isAllowCoreThreadTimeout());
- builder = builder.keepAlive(pool.getKeepAlive());
- TaskExecutionProperties.Shutdown shutdown = properties.getShutdown();
- builder = builder.awaitTermination(shutdown.isAwaitTermination());
- builder = builder.awaitTerminationPeriod(shutdown.getAwaitTerminationPeriod());
- builder = builder.threadNamePrefix(properties.getThreadNamePrefix());
- builder = builder.customizers(taskExecutorCustomizers.orderedStream()::iterator);
- builder = builder.taskDecorator(taskDecorator.getIfUnique());
- return builder;
+ ThreadPoolTaskExecutor applicationTaskExecutor(ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder) {
+ return threadPoolTaskExecutorBuilder.build();
}
}
@Configuration(proxyBeanMethods = false)
- @SuppressWarnings("removal")
static class ThreadPoolTaskExecutorBuilderConfiguration {
@Bean
- @ConditionalOnMissingBean({ TaskExecutorBuilder.class, ThreadPoolTaskExecutorBuilder.class })
+ @ConditionalOnMissingBean(ThreadPoolTaskExecutorBuilder.class)
ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder(TaskExecutionProperties properties,
ObjectProvider threadPoolTaskExecutorCustomizers,
- ObjectProvider taskExecutorCustomizers,
ObjectProvider taskDecorator) {
TaskExecutionProperties.Pool pool = properties.getPool();
ThreadPoolTaskExecutorBuilder builder = new ThreadPoolTaskExecutorBuilder();
@@ -127,15 +88,9 @@ class TaskExecutorConfigurations {
builder = builder.threadNamePrefix(properties.getThreadNamePrefix());
builder = builder.customizers(threadPoolTaskExecutorCustomizers.orderedStream()::iterator);
builder = builder.taskDecorator(taskDecorator.getIfUnique());
- // Apply the deprecated TaskExecutorCustomizers, too
- builder = builder.additionalCustomizers(taskExecutorCustomizers.orderedStream().map(this::adapt).toList());
return builder;
}
- private ThreadPoolTaskExecutorCustomizer adapt(TaskExecutorCustomizer customizer) {
- return customizer::customize;
- }
-
}
@Configuration(proxyBeanMethods = false)
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java
index 5909153ee8e..9b1cbee55fc 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2024 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.
@@ -39,7 +39,6 @@ import org.springframework.scheduling.config.TaskManagementConfigUtils;
@AutoConfiguration(after = TaskExecutionAutoConfiguration.class)
@EnableConfigurationProperties(TaskSchedulingProperties.class)
@Import({ TaskSchedulingConfigurations.ThreadPoolTaskSchedulerBuilderConfiguration.class,
- TaskSchedulingConfigurations.TaskSchedulerBuilderConfiguration.class,
TaskSchedulingConfigurations.SimpleAsyncTaskSchedulerBuilderConfiguration.class,
TaskSchedulingConfigurations.TaskSchedulerConfiguration.class })
public class TaskSchedulingAutoConfiguration {
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingConfigurations.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingConfigurations.java
index 59bee07b10c..53ae5c87021 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingConfigurations.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingConfigurations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2024 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.
@@ -25,8 +25,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnThreading;
import org.springframework.boot.autoconfigure.thread.Threading;
import org.springframework.boot.task.SimpleAsyncTaskSchedulerBuilder;
import org.springframework.boot.task.SimpleAsyncTaskSchedulerCustomizer;
-import org.springframework.boot.task.TaskSchedulerBuilder;
-import org.springframework.boot.task.TaskSchedulerCustomizer;
import org.springframework.boot.task.ThreadPoolTaskSchedulerBuilder;
import org.springframework.boot.task.ThreadPoolTaskSchedulerCustomizer;
import org.springframework.context.annotation.Bean;
@@ -47,7 +45,6 @@ class TaskSchedulingConfigurations {
@Configuration(proxyBeanMethods = false)
@ConditionalOnBean(name = TaskManagementConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME)
@ConditionalOnMissingBean({ TaskScheduler.class, ScheduledExecutorService.class })
- @SuppressWarnings("removal")
static class TaskSchedulerConfiguration {
@Bean(name = "taskScheduler")
@@ -58,47 +55,19 @@ class TaskSchedulingConfigurations {
@Bean
@ConditionalOnThreading(Threading.PLATFORM)
- ThreadPoolTaskScheduler taskScheduler(TaskSchedulerBuilder taskSchedulerBuilder,
- ObjectProvider threadPoolTaskSchedulerBuilderProvider) {
- ThreadPoolTaskSchedulerBuilder threadPoolTaskSchedulerBuilder = threadPoolTaskSchedulerBuilderProvider
- .getIfUnique();
- if (threadPoolTaskSchedulerBuilder != null) {
- return threadPoolTaskSchedulerBuilder.build();
- }
- return taskSchedulerBuilder.build();
+ ThreadPoolTaskScheduler taskScheduler(ThreadPoolTaskSchedulerBuilder threadPoolTaskSchedulerBuilder) {
+ return threadPoolTaskSchedulerBuilder.build();
}
}
@Configuration(proxyBeanMethods = false)
- @SuppressWarnings("removal")
- static class TaskSchedulerBuilderConfiguration {
-
- @Bean
- @ConditionalOnMissingBean
- TaskSchedulerBuilder taskSchedulerBuilder(TaskSchedulingProperties properties,
- ObjectProvider taskSchedulerCustomizers) {
- TaskSchedulerBuilder builder = new TaskSchedulerBuilder();
- builder = builder.poolSize(properties.getPool().getSize());
- TaskSchedulingProperties.Shutdown shutdown = properties.getShutdown();
- builder = builder.awaitTermination(shutdown.isAwaitTermination());
- builder = builder.awaitTerminationPeriod(shutdown.getAwaitTerminationPeriod());
- builder = builder.threadNamePrefix(properties.getThreadNamePrefix());
- builder = builder.customizers(taskSchedulerCustomizers);
- return builder;
- }
-
- }
-
- @Configuration(proxyBeanMethods = false)
- @SuppressWarnings("removal")
static class ThreadPoolTaskSchedulerBuilderConfiguration {
@Bean
- @ConditionalOnMissingBean({ TaskSchedulerBuilder.class, ThreadPoolTaskSchedulerBuilder.class })
+ @ConditionalOnMissingBean(ThreadPoolTaskSchedulerBuilder.class)
ThreadPoolTaskSchedulerBuilder threadPoolTaskSchedulerBuilder(TaskSchedulingProperties properties,
- ObjectProvider threadPoolTaskSchedulerCustomizers,
- ObjectProvider taskSchedulerCustomizers) {
+ ObjectProvider threadPoolTaskSchedulerCustomizers) {
TaskSchedulingProperties.Shutdown shutdown = properties.getShutdown();
ThreadPoolTaskSchedulerBuilder builder = new ThreadPoolTaskSchedulerBuilder();
builder = builder.poolSize(properties.getPool().getSize());
@@ -106,15 +75,9 @@ class TaskSchedulingConfigurations {
builder = builder.awaitTerminationPeriod(shutdown.getAwaitTerminationPeriod());
builder = builder.threadNamePrefix(properties.getThreadNamePrefix());
builder = builder.customizers(threadPoolTaskSchedulerCustomizers);
- // Apply the deprecated TaskSchedulerCustomizers, too
- builder = builder.additionalCustomizers(taskSchedulerCustomizers.orderedStream().map(this::adapt).toList());
return builder;
}
- private ThreadPoolTaskSchedulerCustomizer adapt(TaskSchedulerCustomizer customizer) {
- return customizer::customize;
- }
-
}
@Configuration(proxyBeanMethods = false)
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/PlatformTransactionManagerCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/PlatformTransactionManagerCustomizer.java
deleted file mode 100644
index 1b5cd099471..00000000000
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/PlatformTransactionManagerCustomizer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2012-2023 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.autoconfigure.transaction;
-
-import org.springframework.transaction.PlatformTransactionManager;
-
-/**
- * Callback interface that can be implemented by beans wishing to customize
- * {@link PlatformTransactionManager PlatformTransactionManagers} whilst retaining default
- * auto-configuration.
- *
- * @param the transaction manager type
- * @author Phillip Webb
- * @since 1.5.0
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of
- * {@link TransactionManagerCustomizer}.
- */
-@Deprecated(since = "3.2.0", forRemoval = true)
-@FunctionalInterface
-public interface PlatformTransactionManagerCustomizer
- extends TransactionManagerCustomizer {
-
-}
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizers.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizers.java
index 88f513a3c9d..e4c0b5465c8 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizers.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizers.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2024 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.
@@ -22,7 +22,6 @@ import java.util.Collections;
import java.util.List;
import org.springframework.boot.util.LambdaSafe;
-import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionManager;
/**
@@ -32,38 +31,14 @@ import org.springframework.transaction.TransactionManager;
* @author Andy Wilkinson
* @since 1.5.0
*/
-public class TransactionManagerCustomizers {
+public final class TransactionManagerCustomizers {
private final List extends TransactionManagerCustomizer>> customizers;
- /**
- * Creates a new {@code TransactionManagerCustomizers} instance containing the given
- * {@code customizers}.
- * @param customizers the customizers
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of {@link #of(Collection)}
- */
- @SuppressWarnings("removal")
- @Deprecated(since = "3.2.0", forRemoval = true)
- public TransactionManagerCustomizers(Collection extends PlatformTransactionManagerCustomizer>> customizers) {
- this((customizers != null) ? new ArrayList<>(customizers)
- : Collections.>emptyList());
- }
-
private TransactionManagerCustomizers(List extends TransactionManagerCustomizer>> customizers) {
this.customizers = customizers;
}
- /**
- * Customize the given {@code platformTransactionManager}.
- * @param platformTransactionManager the platform transaction manager to customize
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of
- * {@link #customize(TransactionManager)}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public void customize(PlatformTransactionManager platformTransactionManager) {
- customize((TransactionManager) platformTransactionManager);
- }
-
/**
* Customize the given {@code transactionManager}.
* @param transactionManager the transaction manager to customize
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/JndiJtaConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/JndiJtaConfiguration.java
index 3db22f4cc77..9e51eb2ecaa 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/JndiJtaConfiguration.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/JndiJtaConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2024 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.
@@ -23,7 +23,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.transaction.TransactionManager;
import org.springframework.transaction.jta.JtaTransactionManager;
/**
@@ -44,8 +43,7 @@ class JndiJtaConfiguration {
JtaTransactionManager transactionManager(
ObjectProvider transactionManagerCustomizers) {
JtaTransactionManager jtaTransactionManager = new JtaTransactionManager();
- transactionManagerCustomizers
- .ifAvailable((customizers) -> customizers.customize((TransactionManager) jtaTransactionManager));
+ transactionManagerCustomizers.ifAvailable((customizers) -> customizers.customize(jtaTransactionManager));
return jtaTransactionManager;
}
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration.java
index f8fc51bc013..e32f25072d2 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration.java
@@ -89,18 +89,11 @@ public class DispatcherServletAutoConfiguration {
DispatcherServlet dispatcherServlet = new DispatcherServlet();
dispatcherServlet.setDispatchOptionsRequest(webMvcProperties.isDispatchOptionsRequest());
dispatcherServlet.setDispatchTraceRequest(webMvcProperties.isDispatchTraceRequest());
- configureThrowExceptionIfNoHandlerFound(webMvcProperties, dispatcherServlet);
dispatcherServlet.setPublishEvents(webMvcProperties.isPublishRequestHandledEvents());
dispatcherServlet.setEnableLoggingRequestDetails(webMvcProperties.isLogRequestDetails());
return dispatcherServlet;
}
- @SuppressWarnings({ "deprecation", "removal" })
- private void configureThrowExceptionIfNoHandlerFound(WebMvcProperties webMvcProperties,
- DispatcherServlet dispatcherServlet) {
- dispatcherServlet.setThrowExceptionIfNoHandlerFound(webMvcProperties.isThrowExceptionIfNoHandlerFound());
- }
-
@Bean
@ConditionalOnBean(MultipartResolver.class)
@ConditionalOnMissingBean(name = DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME)
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java
index 9945241d3e4..259f09ee411 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2024 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.
@@ -21,7 +21,6 @@ import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.http.MediaType;
import org.springframework.util.Assert;
import org.springframework.validation.DefaultMessageCodesResolver;
@@ -62,14 +61,6 @@ public class WebMvcProperties {
*/
private boolean publishRequestHandledEvents = true;
- /**
- * Whether a "NoHandlerFoundException" should be thrown if no Handler was found to
- * process a request.
- * @deprecated since 3.2.0 for removal in 3.4.0
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- private boolean throwExceptionIfNoHandlerFound = true;
-
/**
* Whether logging of (potentially sensitive) request details at DEBUG and TRACE level
* is allowed.
@@ -124,19 +115,6 @@ public class WebMvcProperties {
this.publishRequestHandledEvents = publishRequestHandledEvents;
}
- @Deprecated(since = "3.2.0", forRemoval = true)
- @DeprecatedConfigurationProperty(
- reason = "DispatcherServlet property is deprecated for removal and should no longer need to be configured",
- since = "3.2.0")
- public boolean isThrowExceptionIfNoHandlerFound() {
- return this.throwExceptionIfNoHandlerFound;
- }
-
- @Deprecated(since = "3.2.0", forRemoval = true)
- public void setThrowExceptionIfNoHandlerFound(boolean throwExceptionIfNoHandlerFound) {
- this.throwExceptionIfNoHandlerFound = throwExceptionIfNoHandlerFound;
- }
-
public boolean isLogRequestDetails() {
return this.logRequestDetails;
}
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json
index ac7ab276f80..b95c2ac173e 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -1586,6 +1586,27 @@
"level": "error"
}
},
+ {
+ "name": "spring.influx.password",
+ "deprecation": {
+ "level": "error",
+ "reason": "The new InfluxDb Java client provides Spring Boot integration."
+ }
+ },
+ {
+ "name": "spring.influx.url",
+ "deprecation": {
+ "level": "error",
+ "reason": "The new InfluxDb Java client provides Spring Boot integration."
+ }
+ },
+ {
+ "name": "spring.influx.user",
+ "deprecation": {
+ "level": "error",
+ "reason": "The new InfluxDb Java client provides Spring Boot integration."
+ }
+ },
{
"name": "spring.info.build.location",
"defaultValue": "classpath:META-INF/build-info.properties"
@@ -2076,6 +2097,13 @@
"name": "spring.mvc.pathmatch.matching-strategy",
"defaultValue": "path-pattern-parser"
},
+ {
+ "name": "spring.mvc.throw-exception-if-no-handler-found",
+ "deprecation": {
+ "reason": "DispatcherServlet property is deprecated for removal and should no longer need to be configured.",
+ "level": "error"
+ }
+ },
{
"name": "spring.neo4j.security.trust-strategy",
"defaultValue": "trust-system-ca-signed-certificates"
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
index 1f95e7f316e..4250c7a355e 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -63,7 +63,6 @@ org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration
org.springframework.boot.autoconfigure.hazelcast.HazelcastJpaDependencyAutoConfiguration
org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration
org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration
-org.springframework.boot.autoconfigure.influx.InfluxDbAutoConfiguration
org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration
org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/influx/InfluxDbAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/influx/InfluxDbAutoConfigurationTests.java
deleted file mode 100644
index fade2e3b281..00000000000
--- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/influx/InfluxDbAutoConfigurationTests.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2012-2023 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.autoconfigure.influx;
-
-import java.util.concurrent.TimeUnit;
-
-import okhttp3.OkHttpClient;
-import org.influxdb.InfluxDB;
-import org.junit.jupiter.api.Test;
-import retrofit2.Retrofit;
-
-import org.springframework.boot.autoconfigure.AutoConfigurations;
-import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
-import org.springframework.boot.test.context.runner.ApplicationContextRunner;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.test.util.ReflectionTestUtils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Tests for {@link InfluxDbAutoConfiguration}.
- *
- * @author Sergey Kuptsov
- * @author Stephane Nicoll
- * @author Eddú Meléndez
- * @author Moritz Halbritter
- * @author Andy Wilkinson
- * @author Phillip Webb
- */
-@SuppressWarnings("removal")
-@Deprecated(since = "3.2.0", forRemoval = true)
-class InfluxDbAutoConfigurationTests {
-
- private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
- .withConfiguration(AutoConfigurations.of(InfluxDbAutoConfiguration.class));
-
- @Test
- void influxDbRequiresUrl() {
- this.contextRunner.run((context) -> assertThat(context).doesNotHaveBean(InfluxDB.class));
- }
-
- @Test
- void influxDbCanBeCustomized() {
- this.contextRunner
- .withPropertyValues("spring.influx.url=http://localhost", "spring.influx.user=user",
- "spring.influx.password=password")
- .run((context) -> assertThat(context).hasSingleBean(InfluxDB.class));
- }
-
- @Test
- void influxDbCanBeCreatedWithoutCredentials() {
- this.contextRunner.withPropertyValues("spring.influx.url=http://localhost").run((context) -> {
- assertThat(context).hasSingleBean(InfluxDB.class);
- int readTimeout = getReadTimeoutProperty(context);
- assertThat(readTimeout).isEqualTo(10_000);
- });
- }
-
- @Test
- void influxDbWithOkHttpClientBuilderProvider() {
- this.contextRunner.withUserConfiguration(CustomOkHttpClientBuilderProviderConfig.class)
- .withPropertyValues("spring.influx.url=http://localhost")
- .run((context) -> {
- assertThat(context).hasSingleBean(InfluxDB.class);
- int readTimeout = getReadTimeoutProperty(context);
- assertThat(readTimeout).isEqualTo(40_000);
- });
- }
-
- @Test
- void influxDbWithCustomizer() {
- this.contextRunner.withBean(InfluxDbCustomizer.class, () -> (influxDb) -> influxDb.setDatabase("test"))
- .withPropertyValues("spring.influx.url=http://localhost")
- .run((context) -> {
- assertThat(context).hasSingleBean(InfluxDB.class);
- InfluxDB influxDb = context.getBean(InfluxDB.class);
- assertThat(influxDb).hasFieldOrPropertyWithValue("database", "test");
- });
- }
-
- private int getReadTimeoutProperty(AssertableApplicationContext context) {
- InfluxDB influxDb = context.getBean(InfluxDB.class);
- Retrofit retrofit = (Retrofit) ReflectionTestUtils.getField(influxDb, "retrofit");
- OkHttpClient callFactory = (OkHttpClient) retrofit.callFactory();
- return callFactory.readTimeoutMillis();
- }
-
- @Configuration(proxyBeanMethods = false)
- static class CustomOkHttpClientBuilderProviderConfig {
-
- @Bean
- @SuppressWarnings("removal")
- InfluxDbOkHttpClientBuilderProvider influxDbOkHttpClientBuilderProvider() {
- return () -> new OkHttpClient.Builder().readTimeout(40, TimeUnit.SECONDS);
- }
-
- }
-
-}
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfigurationTests.java
index 2ba81d5afea..f8c6f2f337f 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfigurationTests.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfigurationTests.java
@@ -32,8 +32,6 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.task.SimpleAsyncTaskExecutorBuilder;
-import org.springframework.boot.task.TaskExecutorBuilder;
-import org.springframework.boot.task.TaskExecutorCustomizer;
import org.springframework.boot.task.ThreadPoolTaskExecutorBuilder;
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
@@ -51,7 +49,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.BDDMockito.then;
import static org.mockito.Mockito.mock;
/**
@@ -63,7 +60,6 @@ import static org.mockito.Mockito.mock;
* @author Yanming Zhou
*/
@ExtendWith(OutputCaptureExtension.class)
-@SuppressWarnings("removal")
class TaskExecutionAutoConfigurationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
@@ -72,43 +68,12 @@ class TaskExecutionAutoConfigurationTests {
@Test
void shouldSupplyBeans() {
this.contextRunner.run((context) -> {
- assertThat(context).hasSingleBean(TaskExecutorBuilder.class);
assertThat(context).hasSingleBean(ThreadPoolTaskExecutorBuilder.class);
assertThat(context).hasSingleBean(ThreadPoolTaskExecutor.class);
assertThat(context).hasSingleBean(SimpleAsyncTaskExecutorBuilder.class);
});
}
- @Test
- void shouldNotSupplyThreadPoolTaskExecutorBuilderIfCustomTaskExecutorBuilderIsPresent() {
- this.contextRunner.withBean(TaskExecutorBuilder.class, TaskExecutorBuilder::new).run((context) -> {
- assertThat(context).hasSingleBean(TaskExecutorBuilder.class);
- assertThat(context).doesNotHaveBean(ThreadPoolTaskExecutorBuilder.class);
- assertThat(context).hasSingleBean(ThreadPoolTaskExecutor.class);
- });
- }
-
- @Test
- void taskExecutorBuilderShouldApplyCustomSettings() {
- this.contextRunner
- .withPropertyValues("spring.task.execution.pool.queue-capacity=10",
- "spring.task.execution.pool.core-size=2", "spring.task.execution.pool.max-size=4",
- "spring.task.execution.pool.allow-core-thread-timeout=true",
- "spring.task.execution.pool.keep-alive=5s", "spring.task.execution.shutdown.await-termination=true",
- "spring.task.execution.shutdown.await-termination-period=30s",
- "spring.task.execution.thread-name-prefix=mytest-")
- .run(assertTaskExecutor((taskExecutor) -> {
- assertThat(taskExecutor).hasFieldOrPropertyWithValue("queueCapacity", 10);
- assertThat(taskExecutor.getCorePoolSize()).isEqualTo(2);
- assertThat(taskExecutor.getMaxPoolSize()).isEqualTo(4);
- assertThat(taskExecutor).hasFieldOrPropertyWithValue("allowCoreThreadTimeOut", true);
- assertThat(taskExecutor.getKeepAliveSeconds()).isEqualTo(5);
- assertThat(taskExecutor).hasFieldOrPropertyWithValue("waitForTasksToCompleteOnShutdown", true);
- assertThat(taskExecutor).hasFieldOrPropertyWithValue("awaitTerminationMillis", 30000L);
- assertThat(taskExecutor.getThreadNamePrefix()).isEqualTo("mytest-");
- }));
- }
-
@Test
void simpleAsyncTaskExecutorBuilderShouldReadProperties() {
this.contextRunner
@@ -145,15 +110,6 @@ class TaskExecutionAutoConfigurationTests {
}));
}
- @Test
- void taskExecutorBuilderWhenHasCustomBuilderShouldUseCustomBuilder() {
- this.contextRunner.withUserConfiguration(CustomTaskExecutorBuilderConfig.class).run((context) -> {
- assertThat(context).hasSingleBean(TaskExecutorBuilder.class);
- assertThat(context.getBean(TaskExecutorBuilder.class))
- .isSameAs(context.getBean(CustomTaskExecutorBuilderConfig.class).taskExecutorBuilder);
- });
- }
-
@Test
void threadPoolTaskExecutorBuilderWhenHasCustomBuilderShouldUseCustomBuilder() {
this.contextRunner.withUserConfiguration(CustomThreadPoolTaskExecutorBuilderConfig.class).run((context) -> {
@@ -163,15 +119,6 @@ class TaskExecutionAutoConfigurationTests {
});
}
- @Test
- void taskExecutorBuilderShouldUseTaskDecorator() {
- this.contextRunner.withUserConfiguration(TaskDecoratorConfig.class).run((context) -> {
- assertThat(context).hasSingleBean(TaskExecutorBuilder.class);
- ThreadPoolTaskExecutor executor = context.getBean(TaskExecutorBuilder.class).build();
- assertThat(executor).extracting("taskDecorator").isSameAs(context.getBean(TaskDecorator.class));
- });
- }
-
@Test
void threadPoolTaskExecutorBuilderShouldUseTaskDecorator() {
this.contextRunner.withUserConfiguration(TaskDecoratorConfig.class).run((context) -> {
@@ -274,24 +221,6 @@ class TaskExecutionAutoConfigurationTests {
});
}
- @Test
- void taskExecutorBuilderShouldApplyCustomizer() {
- this.contextRunner.withUserConfiguration(TaskExecutorCustomizerConfig.class).run((context) -> {
- TaskExecutorCustomizer customizer = context.getBean(TaskExecutorCustomizer.class);
- ThreadPoolTaskExecutor executor = context.getBean(TaskExecutorBuilder.class).build();
- then(customizer).should().customize(executor);
- });
- }
-
- @Test
- void threadPoolTaskExecutorBuilderShouldApplyCustomizer() {
- this.contextRunner.withUserConfiguration(TaskExecutorCustomizerConfig.class).run((context) -> {
- TaskExecutorCustomizer customizer = context.getBean(TaskExecutorCustomizer.class);
- ThreadPoolTaskExecutor executor = context.getBean(ThreadPoolTaskExecutorBuilder.class).build();
- then(customizer).should().customize(executor);
- });
- }
-
@Test
void enableAsyncUsesAutoConfiguredOneByDefault() {
this.contextRunner.withPropertyValues("spring.task.execution.thread-name-prefix=task-test-")
@@ -316,34 +245,6 @@ class TaskExecutionAutoConfigurationTests {
});
}
- @Test
- void customTaskExecutorBuilderOverridesThreadPoolTaskExecutorBuilder() {
- this.contextRunner.withUserConfiguration(CustomTaskExecutorBuilderConfig.class).run((context) -> {
- ThreadPoolTaskExecutor bean = context.getBean(ThreadPoolTaskExecutor.class);
- assertThat(bean.getThreadNamePrefix()).isEqualTo("CustomTaskExecutorBuilderConfig-");
- });
- }
-
- @Test
- void threadPoolTaskExecutorBuilderAppliesTaskExecutorCustomizer() {
- this.contextRunner
- .withBean(TaskExecutorCustomizer.class,
- () -> (taskExecutor) -> taskExecutor.setThreadNamePrefix("custom-prefix-"))
- .run((context) -> {
- ThreadPoolTaskExecutor bean = context.getBean(ThreadPoolTaskExecutor.class);
- assertThat(bean.getThreadNamePrefix()).isEqualTo("custom-prefix-");
- });
- }
-
- private ContextConsumer assertTaskExecutor(
- Consumer taskExecutor) {
- return (context) -> {
- assertThat(context).hasSingleBean(TaskExecutorBuilder.class);
- TaskExecutorBuilder builder = context.getBean(TaskExecutorBuilder.class);
- taskExecutor.accept(builder.build());
- };
- }
-
private ContextConsumer assertThreadPoolTaskExecutor(
Consumer taskExecutor) {
return (context) -> {
@@ -376,19 +277,6 @@ class TaskExecutionAutoConfigurationTests {
return thread.getName();
}
- @Configuration(proxyBeanMethods = false)
- static class CustomTaskExecutorBuilderConfig {
-
- private final TaskExecutorBuilder taskExecutorBuilder = new TaskExecutorBuilder()
- .threadNamePrefix("CustomTaskExecutorBuilderConfig-");
-
- @Bean
- TaskExecutorBuilder customTaskExecutorBuilder() {
- return this.taskExecutorBuilder;
- }
-
- }
-
@Configuration(proxyBeanMethods = false)
static class CustomThreadPoolTaskExecutorBuilderConfig {
@@ -401,16 +289,6 @@ class TaskExecutionAutoConfigurationTests {
}
- @Configuration(proxyBeanMethods = false)
- static class TaskExecutorCustomizerConfig {
-
- @Bean
- TaskExecutorCustomizer mockTaskExecutorCustomizer() {
- return mock(TaskExecutorCustomizer.class);
- }
-
- }
-
@Configuration(proxyBeanMethods = false)
static class TaskDecoratorConfig {
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfigurationTests.java
index 57ed26c15ca..74dc49d9740 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfigurationTests.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfigurationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2024 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.
@@ -36,8 +36,6 @@ import org.springframework.boot.LazyInitializationBeanFactoryPostProcessor;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.task.SimpleAsyncTaskSchedulerBuilder;
import org.springframework.boot.task.SimpleAsyncTaskSchedulerCustomizer;
-import org.springframework.boot.task.TaskSchedulerBuilder;
-import org.springframework.boot.task.TaskSchedulerCustomizer;
import org.springframework.boot.task.ThreadPoolTaskSchedulerBuilder;
import org.springframework.boot.task.ThreadPoolTaskSchedulerCustomizer;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
@@ -59,7 +57,6 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Stephane Nicoll
* @author Moritz Halbritter
*/
-@SuppressWarnings("removal")
class TaskSchedulingAutoConfigurationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
@@ -80,23 +77,11 @@ class TaskSchedulingAutoConfigurationTests {
@Test
void shouldSupplyBeans() {
this.contextRunner.withUserConfiguration(SchedulingConfiguration.class).run((context) -> {
- assertThat(context).hasSingleBean(TaskSchedulerBuilder.class);
assertThat(context).hasSingleBean(ThreadPoolTaskSchedulerBuilder.class);
assertThat(context).hasSingleBean(ThreadPoolTaskScheduler.class);
});
}
- @Test
- void shouldNotSupplyThreadPoolTaskSchedulerBuilderIfCustomTaskSchedulerBuilderIsPresent() {
- this.contextRunner.withUserConfiguration(SchedulingConfiguration.class)
- .withBean(TaskSchedulerBuilder.class, TaskSchedulerBuilder::new)
- .run((context) -> {
- assertThat(context).hasSingleBean(TaskSchedulerBuilder.class);
- assertThat(context).doesNotHaveBean(ThreadPoolTaskSchedulerBuilder.class);
- assertThat(context).hasSingleBean(ThreadPoolTaskScheduler.class);
- });
- }
-
@Test
void enableSchedulingWithNoTaskExecutorAutoConfiguresOne() {
this.contextRunner
@@ -155,7 +140,6 @@ class TaskSchedulingAutoConfigurationTests {
}
@Test
- @SuppressWarnings("unchecked")
void simpleAsyncTaskSchedulerBuilderShouldApplyCustomizers() {
SimpleAsyncTaskSchedulerCustomizer customizer = (scheduler) -> {
};
@@ -170,18 +154,6 @@ class TaskSchedulingAutoConfigurationTests {
});
}
- @Test
- void enableSchedulingWithNoTaskExecutorAppliesTaskSchedulerCustomizers() {
- this.contextRunner.withPropertyValues("spring.task.scheduling.thread-name-prefix=scheduling-test-")
- .withUserConfiguration(SchedulingConfiguration.class, TaskSchedulerCustomizerConfiguration.class)
- .run((context) -> {
- assertThat(context).hasSingleBean(TaskExecutor.class);
- TestBean bean = context.getBean(TestBean.class);
- assertThat(bean.latch.await(30, TimeUnit.SECONDS)).isTrue();
- assertThat(bean.threadNames).allMatch((name) -> name.contains("customized-scheduler-"));
- });
- }
-
@Test
void enableSchedulingWithNoTaskExecutorAppliesCustomizers() {
this.contextRunner.withPropertyValues("spring.task.scheduling.thread-name-prefix=scheduling-test-")
@@ -262,16 +234,6 @@ class TaskSchedulingAutoConfigurationTests {
}
- @Configuration(proxyBeanMethods = false)
- static class TaskSchedulerCustomizerConfiguration {
-
- @Bean
- TaskSchedulerCustomizer testTaskSchedulerCustomizer() {
- return ((taskScheduler) -> taskScheduler.setThreadNamePrefix("customized-scheduler-"));
- }
-
- }
-
@Configuration(proxyBeanMethods = false)
static class ThreadPoolTaskSchedulerCustomizerConfiguration {
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizersTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizersTests.java
index 396b0098765..d4dc3dc8a5a 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizersTests.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizersTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2024 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.
@@ -46,8 +46,8 @@ class TransactionManagerCustomizersTests {
list.add(new TestCustomizer<>());
list.add(new TestJtaCustomizer());
TransactionManagerCustomizers customizers = TransactionManagerCustomizers.of(list);
- customizers.customize((TransactionManager) mock(PlatformTransactionManager.class));
- customizers.customize((TransactionManager) mock(JtaTransactionManager.class));
+ customizers.customize(mock(PlatformTransactionManager.class));
+ customizers.customize(mock(JtaTransactionManager.class));
assertThat(list.get(0).getCount()).isEqualTo(2);
assertThat(list.get(1).getCount()).isOne();
}
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfigurationTests.java
index 100d36cdd91..ca059493705 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfigurationTests.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfigurationTests.java
@@ -162,12 +162,10 @@ class DispatcherServletAutoConfigurationTests {
@Test
void dispatcherServletCustomConfig() {
this.contextRunner
- .withPropertyValues("spring.mvc.throw-exception-if-no-handler-found:false",
- "spring.mvc.dispatch-options-request:false", "spring.mvc.dispatch-trace-request:true",
+ .withPropertyValues("spring.mvc.dispatch-options-request:false", "spring.mvc.dispatch-trace-request:true",
"spring.mvc.publish-request-handled-events:false", "spring.mvc.servlet.load-on-startup=5")
.run((context) -> {
DispatcherServlet dispatcherServlet = context.getBean(DispatcherServlet.class);
- assertThat(dispatcherServlet).extracting("throwExceptionIfNoHandlerFound").isEqualTo(false);
assertThat(dispatcherServlet).extracting("dispatchOptionsRequest").isEqualTo(false);
assertThat(dispatcherServlet).extracting("dispatchTraceRequest").isEqualTo(true);
assertThat(dispatcherServlet).extracting("publishEvents").isEqualTo(false);
@@ -176,15 +174,6 @@ class DispatcherServletAutoConfigurationTests {
});
}
- @Test
- @Deprecated(since = "3.2.0", forRemoval = true)
- void dispatcherServletThrowExceptionIfNoHandlerFoundCustomConfig() {
- this.contextRunner.withPropertyValues("spring.mvc.throw-exception-if-no-handler-found:false").run((context) -> {
- DispatcherServlet dispatcherServlet = context.getBean(DispatcherServlet.class);
- assertThat(dispatcherServlet).extracting("throwExceptionIfNoHandlerFound").isEqualTo(false);
- });
- }
-
@Configuration(proxyBeanMethods = false)
static class MultipartConfiguration {
diff --git a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc
index b834abc14b0..2b442672376 100644
--- a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc
+++ b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc
@@ -609,7 +609,7 @@
* xref:maven-plugin:integration-tests.adoc#integration-tests.start-goal.parameter-details.arguments[maven-plugin#integration-tests.start-goal.parameter-details.arguments]
* xref:maven-plugin:integration-tests.adoc#integration-tests.start-goal.parameter-details.classes-directory[maven-plugin#integration-tests.start-goal.parameter-details.classes-directory]
* xref:maven-plugin:integration-tests.adoc#integration-tests.start-goal.parameter-details.commandline-arguments[maven-plugin#integration-tests.start-goal.parameter-details.commandline-arguments]
-* xref:maven-plugin:integration-tests.adoc#integration-tests.start-goal.parameter-details.directories[maven-plugin#integration-tests.start-goal.parameter-details.directories]
+* xref:maven-plugin:integration-tests.adoc#integration-tests.start-goal.parameter-details.additional-classpath-elements[maven-plugin#integration-tests.start-goal.parameter-details.directories]
* xref:maven-plugin:integration-tests.adoc#integration-tests.start-goal.parameter-details.environment-variables[maven-plugin#integration-tests.start-goal.parameter-details.environment-variables]
* xref:maven-plugin:integration-tests.adoc#integration-tests.start-goal.parameter-details.exclude-group-ids[maven-plugin#integration-tests.start-goal.parameter-details.exclude-group-ids]
* xref:maven-plugin:integration-tests.adoc#integration-tests.start-goal.parameter-details.excludes[maven-plugin#integration-tests.start-goal.parameter-details.excludes]
@@ -685,7 +685,7 @@
* xref:maven-plugin:run.adoc#run.run-goal.parameter-details.arguments[maven-plugin#run.run-goal.parameter-details.arguments]
* xref:maven-plugin:run.adoc#run.run-goal.parameter-details.classes-directory[maven-plugin#run.run-goal.parameter-details.classes-directory]
* xref:maven-plugin:run.adoc#run.run-goal.parameter-details.commandline-arguments[maven-plugin#run.run-goal.parameter-details.commandline-arguments]
-* xref:maven-plugin:run.adoc#run.run-goal.parameter-details.directories[maven-plugin#run.run-goal.parameter-details.directories]
+* xref:maven-plugin:run.adoc#run.run-goal.parameter-details.additional-classpath-elements[maven-plugin#run.run-goal.parameter-details.directories]
* xref:maven-plugin:run.adoc#run.run-goal.parameter-details.environment-variables[maven-plugin#run.run-goal.parameter-details.environment-variables]
* xref:maven-plugin:run.adoc#run.run-goal.parameter-details.exclude-group-ids[maven-plugin#run.run-goal.parameter-details.exclude-group-ids]
* xref:maven-plugin:run.adoc#run.run-goal.parameter-details.excludes[maven-plugin#run.run-goal.parameter-details.excludes]
@@ -709,7 +709,7 @@
* xref:maven-plugin:run.adoc#run.test-run-goal.parameter-details.arguments[maven-plugin#run.test-run-goal.parameter-details.arguments]
* xref:maven-plugin:run.adoc#run.test-run-goal.parameter-details.classes-directory[maven-plugin#run.test-run-goal.parameter-details.classes-directory]
* xref:maven-plugin:run.adoc#run.test-run-goal.parameter-details.commandline-arguments[maven-plugin#run.test-run-goal.parameter-details.commandline-arguments]
-* xref:maven-plugin:run.adoc#run.test-run-goal.parameter-details.directories[maven-plugin#run.test-run-goal.parameter-details.directories]
+* xref:maven-plugin:run.adoc#run.test-run-goal.parameter-details.additional-classpath-elements[maven-plugin#run.test-run-goal.parameter-details.directories]
* xref:maven-plugin:run.adoc#run.test-run-goal.parameter-details.environment-variables[maven-plugin#run.test-run-goal.parameter-details.environment-variables]
* xref:maven-plugin:run.adoc#run.test-run-goal.parameter-details.exclude-group-ids[maven-plugin#run.test-run-goal.parameter-details.exclude-group-ids]
* xref:maven-plugin:run.adoc#run.test-run-goal.parameter-details.excludes[maven-plugin#run.test-run-goal.parameter-details.excludes]
diff --git a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/endpoints.adoc b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/endpoints.adoc
index e2bfc4fa669..4ab350b0cff 100644
--- a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/endpoints.adoc
+++ b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/endpoints.adoc
@@ -616,10 +616,6 @@ with the `key` listed in the following table:
| xref:api:java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicator.html[`HazelcastHealthIndicator`]
| Checks that a Hazelcast server is up.
-| `influxdb`
-| xref:api:java/org/springframework/boot/actuate/influx/InfluxDbHealthIndicator.html[`InfluxDbHealthIndicator`]
-| Checks that an InfluxDB server is up.
-
| `jms`
| xref:api:java/org/springframework/boot/actuate/jms/JmsHealthIndicator.html[`JmsHealthIndicator`]
| Checks that a JMS broker is up.
diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcConfiguration.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcConfiguration.java
index 6ed6eb97028..2ee2b145cc6 100644
--- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcConfiguration.java
+++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcConfiguration.java
@@ -83,13 +83,6 @@ class MockMvcConfiguration {
public void customize(DispatcherServlet dispatcherServlet) {
dispatcherServlet.setDispatchOptionsRequest(this.webMvcProperties.isDispatchOptionsRequest());
dispatcherServlet.setDispatchTraceRequest(this.webMvcProperties.isDispatchTraceRequest());
- configureThrowExceptionIfNoHandlerFound(dispatcherServlet);
- }
-
- @SuppressWarnings({ "deprecation", "removal" })
- private void configureThrowExceptionIfNoHandlerFound(DispatcherServlet dispatcherServlet) {
- dispatcherServlet
- .setThrowExceptionIfNoHandlerFound(this.webMvcProperties.isThrowExceptionIfNoHandlerFound());
}
}
diff --git a/spring-boot-project/spring-boot-testcontainers/src/dockerTest/java/org/springframework/boot/testcontainers/properties/TestcontainersPropertySourceAutoConfigurationTests.java b/spring-boot-project/spring-boot-testcontainers/src/dockerTest/java/org/springframework/boot/testcontainers/properties/TestcontainersPropertySourceAutoConfigurationTests.java
index 0461375186b..310c0758f0f 100644
--- a/spring-boot-project/spring-boot-testcontainers/src/dockerTest/java/org/springframework/boot/testcontainers/properties/TestcontainersPropertySourceAutoConfigurationTests.java
+++ b/spring-boot-project/spring-boot-testcontainers/src/dockerTest/java/org/springframework/boot/testcontainers/properties/TestcontainersPropertySourceAutoConfigurationTests.java
@@ -25,6 +25,7 @@ import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+import org.springframework.boot.testcontainers.lifecycle.BeforeTestcontainerUsedEvent;
import org.springframework.boot.testcontainers.lifecycle.TestcontainersLifecycleApplicationContextInitializer;
import org.springframework.boot.testsupport.container.DisabledIfDockerUnavailable;
import org.springframework.boot.testsupport.container.RedisContainer;
@@ -50,7 +51,6 @@ class TestcontainersPropertySourceAutoConfigurationTests {
.withConfiguration(AutoConfigurations.of(TestcontainersPropertySourceAutoConfiguration.class));
@Test
- @SuppressWarnings("removal")
void containerBeanMethodContributesProperties() {
List events = new ArrayList<>();
this.contextRunner.withUserConfiguration(ContainerAndPropertiesConfiguration.class)
@@ -59,8 +59,7 @@ class TestcontainersPropertySourceAutoConfigurationTests {
TestBean testBean = context.getBean(TestBean.class);
RedisContainer redisContainer = context.getBean(RedisContainer.class);
assertThat(testBean.getUsingPort()).isEqualTo(redisContainer.getFirstMappedPort());
- assertThat(events.stream().filter(BeforeTestcontainersPropertySuppliedEvent.class::isInstance))
- .hasSize(1);
+ assertThat(events.stream().filter(BeforeTestcontainerUsedEvent.class::isInstance)).hasSize(1);
});
}
diff --git a/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/properties/BeforeTestcontainersPropertySuppliedEvent.java b/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/properties/BeforeTestcontainersPropertySuppliedEvent.java
deleted file mode 100644
index 0ed3c395936..00000000000
--- a/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/properties/BeforeTestcontainersPropertySuppliedEvent.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2012-2024 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.testcontainers.properties;
-
-import java.util.function.Supplier;
-
-import org.springframework.boot.testcontainers.lifecycle.BeforeTestcontainerUsedEvent;
-
-/**
- * Event published just before the {@link Supplier value supplier} of a
- * {@link TestcontainersPropertySource} property is called.
- *
- * @author Phillip Webb
- * @since 3.2.2
- * @deprecated since 3.2.6 for removal in 3.4.0 in favor of
- * {@link BeforeTestcontainerUsedEvent}
- */
-@Deprecated(since = "3.2.6", forRemoval = true)
-public class BeforeTestcontainersPropertySuppliedEvent extends BeforeTestcontainerUsedEvent {
-
- private final String propertyName;
-
- BeforeTestcontainersPropertySuppliedEvent(TestcontainersPropertySource source, String propertyName) {
- super(source);
- this.propertyName = propertyName;
- }
-
- /**
- * Return the name of the property about to be supplied.
- * @return the propertyName the property name
- */
- public String getPropertyName() {
- return this.propertyName;
- }
-
-}
diff --git a/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/properties/TestcontainersPropertySource.java b/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/properties/TestcontainersPropertySource.java
index 751dc7c6798..ee2ae41359b 100644
--- a/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/properties/TestcontainersPropertySource.java
+++ b/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/properties/TestcontainersPropertySource.java
@@ -30,6 +30,7 @@ import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
+import org.springframework.boot.testcontainers.lifecycle.BeforeTestcontainerUsedEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.context.ConfigurableApplicationContext;
@@ -80,9 +81,8 @@ public class TestcontainersPropertySource extends MapPropertySource {
return (valueSupplier != null) ? getProperty(name, valueSupplier) : null;
}
- @SuppressWarnings({ "removal", "deprecation" })
private Object getProperty(String name, Object valueSupplier) {
- BeforeTestcontainersPropertySuppliedEvent event = new BeforeTestcontainersPropertySuppliedEvent(this, name);
+ BeforeTestcontainerUsedEvent event = new BeforeTestcontainerUsedEvent(this);
this.eventPublishers.forEach((eventPublisher) -> eventPublisher.publishEvent(event));
return SupplierUtils.resolve(valueSupplier);
}
diff --git a/spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/properties/TestcontainersPropertySourceTests.java b/spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/properties/TestcontainersPropertySourceTests.java
index 8b913d4945b..86d43e647f2 100644
--- a/spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/properties/TestcontainersPropertySourceTests.java
+++ b/spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/properties/TestcontainersPropertySourceTests.java
@@ -24,6 +24,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.boot.testcontainers.lifecycle.BeforeTestcontainerUsedEvent;
import org.springframework.boot.testcontainers.properties.TestcontainersPropertySource.EventPublisherRegistrar;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.support.GenericApplicationContext;
@@ -134,7 +135,6 @@ class TestcontainersPropertySourceTests {
}
@Test
- @SuppressWarnings("removal")
void getPropertyPublishesEvent() {
try (GenericApplicationContext applicationContext = new GenericApplicationContext()) {
List events = new ArrayList<>();
@@ -146,7 +146,7 @@ class TestcontainersPropertySourceTests {
assertThat(applicationContext.getEnvironment().containsProperty("test")).isTrue();
assertThat(events.isEmpty());
assertThat(applicationContext.getEnvironment().getProperty("test")).isEqualTo("spring");
- assertThat(events.stream().filter(BeforeTestcontainersPropertySuppliedEvent.class::isInstance)).hasSize(1);
+ assertThat(events.stream().filter(BeforeTestcontainerUsedEvent.class::isInstance)).hasSize(1);
}
}
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/RunIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/RunIntegrationTests.java
index e3e93e0ee19..81c9bfcb25b 100644
--- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/RunIntegrationTests.java
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/RunIntegrationTests.java
@@ -108,14 +108,6 @@ class RunIntegrationTests {
.execute((project) -> assertThat(buildLog(project)).containsPattern("I haz been run from.*src.main.java"));
}
- @TestTemplate
- @Deprecated(since = "3.2.0", forRemoval = true)
- void whenDirectoriesAreConfiguredTheyAreAvailableToTheApplication(MavenBuild mavenBuild) {
- mavenBuild.project("run-directories")
- .goals("spring-boot:run")
- .execute((project) -> assertThat(buildLog(project)).contains("I haz been run"));
- }
-
@TestTemplate
void whenAdditionalClasspathDirectoryIsConfiguredItsResourcesAreAvailableToTheApplication(MavenBuild mavenBuild) {
mavenBuild.project("run-additional-classpath-directory")
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/run-directories/pom.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/run-directories/pom.xml
deleted file mode 100644
index 4029ed38e43..00000000000
--- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/run-directories/pom.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
- 4.0.0
- org.springframework.boot.maven.it
- run-directories
- 0.0.1.BUILD-SNAPSHOT
-
- UTF-8
- @java.version@
- @java.version@
-
-
-
-
- @project.groupId@
- @project.artifactId@
- @project.version@
-
-
- src/main/additional-elements/
-
-
-
-
-
-
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/run-directories/src/main/additional-elements/another/two.txt b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/run-directories/src/main/additional-elements/another/two.txt
deleted file mode 100644
index d8263ee9860..00000000000
--- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/run-directories/src/main/additional-elements/another/two.txt
+++ /dev/null
@@ -1 +0,0 @@
-2
\ No newline at end of file
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/run-directories/src/main/additional-elements/one.txt b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/run-directories/src/main/additional-elements/one.txt
deleted file mode 100644
index 56a6051ca2b..00000000000
--- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/run-directories/src/main/additional-elements/one.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
\ No newline at end of file
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/run-directories/src/main/java/org/test/SampleApplication.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/run-directories/src/main/java/org/test/SampleApplication.java
deleted file mode 100644
index 944441df246..00000000000
--- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/run-directories/src/main/java/org/test/SampleApplication.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2012-2023 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.test;
-
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-import java.util.Scanner;
-
-public class SampleApplication {
-
- public static void main(String[] args) {
- if (!readContent("one.txt").contains("1")) {
- throw new IllegalArgumentException("Invalid content for one.txt");
- }
- if (!readContent("another/two.txt").contains("2")) {
- throw new IllegalArgumentException("Invalid content for another/two.txt");
- }
- System.out.println("I haz been run");
- }
-
- private static String readContent(String location) {
- InputStream in = SampleApplication.class.getClassLoader().getResourceAsStream(location);
- if (in == null) {
- throw new IllegalArgumentException("Not found: '" + location + "'");
- }
- try (Scanner scanner = new Scanner(in, StandardCharsets.UTF_8)) {
- return scanner.useDelimiter("\\A").next();
- }
- }
-
-}
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java
index f21d6c8308c..89c4d0516c7 100644
--- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java
@@ -42,8 +42,6 @@ import org.apache.maven.project.MavenProject;
import org.apache.maven.toolchain.ToolchainManager;
import org.springframework.boot.loader.tools.FileUtils;
-import org.springframework.util.Assert;
-import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
/**
@@ -171,17 +169,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@Parameter(property = "spring-boot.run.main-class")
private String mainClass;
- /**
- * Additional directories containing classes or resources that should be added to the
- * classpath.
- * @since 1.0.0
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of
- * 'additionalClasspathElements'
- */
- @Parameter(property = "spring-boot.run.directories")
- @Deprecated(since = "3.2.0", forRemoval = true)
- private String[] directories;
-
/**
* Additional classpath elements that should be added to the classpath. An element can
* be a directory with classes and resources or a jar file.
@@ -403,12 +390,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
}
private void addAdditionalClasspathLocations(List urls) throws MalformedURLException {
- Assert.state(ObjectUtils.isEmpty(this.directories) || ObjectUtils.isEmpty(this.additionalClasspathElements),
- "Either additionalClasspathElements or directories (deprecated) should be set, not both");
- String[] elements = !ObjectUtils.isEmpty(this.additionalClasspathElements) ? this.additionalClasspathElements
- : this.directories;
- if (elements != null) {
- for (String element : elements) {
+ if (this.additionalClasspathElements != null) {
+ for (String element : this.additionalClasspathElements) {
urls.add(new File(element).toURI().toURL());
}
}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializer.java
deleted file mode 100644
index 3cf1721734b..00000000000
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializer.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2012-2023 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.context.config;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.springframework.beans.BeanUtils;
-import org.springframework.context.ApplicationContextException;
-import org.springframework.context.ApplicationContextInitializer;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.core.GenericTypeResolver;
-import org.springframework.core.Ordered;
-import org.springframework.core.annotation.AnnotationAwareOrderComparator;
-import org.springframework.core.env.ConfigurableEnvironment;
-import org.springframework.util.Assert;
-import org.springframework.util.ClassUtils;
-import org.springframework.util.StringUtils;
-
-/**
- * {@link ApplicationContextInitializer} that delegates to other initializers that are
- * specified under a {@literal context.initializer.classes} environment property.
- *
- * @author Dave Syer
- * @author Phillip Webb
- * @since 1.0.0
- * @deprecated since 3.2.0 for removal in 3.4.0 as property based initialization is no
- * longer recommended
- */
-@Deprecated(since = "3.2.0", forRemoval = true)
-public class DelegatingApplicationContextInitializer
- implements ApplicationContextInitializer, Ordered {
-
- // NOTE: Similar to org.springframework.web.context.ContextLoader
-
- private static final String PROPERTY_NAME = "context.initializer.classes";
-
- private int order = 0;
-
- @Override
- public void initialize(ConfigurableApplicationContext context) {
- ConfigurableEnvironment environment = context.getEnvironment();
- List> initializerClasses = getInitializerClasses(environment);
- if (!initializerClasses.isEmpty()) {
- applyInitializerClasses(context, initializerClasses);
- }
- }
-
- private List> getInitializerClasses(ConfigurableEnvironment env) {
- String classNames = env.getProperty(PROPERTY_NAME);
- List> classes = new ArrayList<>();
- if (StringUtils.hasLength(classNames)) {
- for (String className : StringUtils.tokenizeToStringArray(classNames, ",")) {
- classes.add(getInitializerClass(className));
- }
- }
- return classes;
- }
-
- private Class> getInitializerClass(String className) throws LinkageError {
- try {
- Class> initializerClass = ClassUtils.forName(className, ClassUtils.getDefaultClassLoader());
- Assert.isAssignable(ApplicationContextInitializer.class, initializerClass);
- return initializerClass;
- }
- catch (ClassNotFoundException ex) {
- throw new ApplicationContextException("Failed to load context initializer class [" + className + "]", ex);
- }
- }
-
- private void applyInitializerClasses(ConfigurableApplicationContext context, List> initializerClasses) {
- Class> contextClass = context.getClass();
- List> initializers = new ArrayList<>();
- for (Class> initializerClass : initializerClasses) {
- initializers.add(instantiateInitializer(contextClass, initializerClass));
- }
- applyInitializers(context, initializers);
- }
-
- private ApplicationContextInitializer> instantiateInitializer(Class> contextClass, Class> initializerClass) {
- Class> requireContextClass = GenericTypeResolver.resolveTypeArgument(initializerClass,
- ApplicationContextInitializer.class);
- Assert.isAssignable(requireContextClass, contextClass,
- () -> String.format(
- "Could not add context initializer [%s] as its generic parameter [%s] is not assignable "
- + "from the type of application context used by this context loader [%s]: ",
- initializerClass.getName(), requireContextClass.getName(), contextClass.getName()));
- return (ApplicationContextInitializer>) BeanUtils.instantiateClass(initializerClass);
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- private void applyInitializers(ConfigurableApplicationContext context,
- List> initializers) {
- initializers.sort(new AnnotationAwareOrderComparator());
- for (ApplicationContextInitializer initializer : initializers) {
- initializer.initialize(context);
- }
- }
-
- public void setOrder(int order) {
- this.order = order;
- }
-
- @Override
- public int getOrder() {
- return this.order;
- }
-
-}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java
deleted file mode 100644
index 41c85cc354b..00000000000
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2012-2023 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.context.config;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.springframework.beans.BeanUtils;
-import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
-import org.springframework.context.ApplicationContextException;
-import org.springframework.context.ApplicationEvent;
-import org.springframework.context.ApplicationListener;
-import org.springframework.context.event.SimpleApplicationEventMulticaster;
-import org.springframework.core.Ordered;
-import org.springframework.core.annotation.AnnotationAwareOrderComparator;
-import org.springframework.core.env.ConfigurableEnvironment;
-import org.springframework.util.Assert;
-import org.springframework.util.ClassUtils;
-import org.springframework.util.StringUtils;
-
-/**
- * {@link ApplicationListener} that delegates to other listeners that are specified under
- * a {@literal context.listener.classes} environment property.
- *
- * @author Dave Syer
- * @author Phillip Webb
- * @since 1.0.0
- * @deprecated since 3.2.0 for removal in 3.4.0 as property based initialization is no
- * longer recommended
- */
-@Deprecated(since = "3.2.0", forRemoval = true)
-public class DelegatingApplicationListener implements ApplicationListener, Ordered {
-
- // NOTE: Similar to org.springframework.web.context.ContextLoader
-
- private static final String PROPERTY_NAME = "context.listener.classes";
-
- private int order = 0;
-
- private SimpleApplicationEventMulticaster multicaster;
-
- @Override
- public void onApplicationEvent(ApplicationEvent event) {
- if (event instanceof ApplicationEnvironmentPreparedEvent preparedEvent) {
- List> delegates = getListeners(preparedEvent.getEnvironment());
- if (delegates.isEmpty()) {
- return;
- }
- this.multicaster = new SimpleApplicationEventMulticaster();
- for (ApplicationListener listener : delegates) {
- this.multicaster.addApplicationListener(listener);
- }
- }
- if (this.multicaster != null) {
- this.multicaster.multicastEvent(event);
- }
- }
-
- @SuppressWarnings("unchecked")
- private List> getListeners(ConfigurableEnvironment environment) {
- if (environment == null) {
- return Collections.emptyList();
- }
- String classNames = environment.getProperty(PROPERTY_NAME);
- List> listeners = new ArrayList<>();
- if (StringUtils.hasLength(classNames)) {
- for (String className : StringUtils.commaDelimitedListToSet(classNames)) {
- try {
- Class> clazz = ClassUtils.forName(className, ClassUtils.getDefaultClassLoader());
- Assert.isAssignable(ApplicationListener.class, clazz,
- () -> "class [" + className + "] must implement ApplicationListener");
- listeners.add((ApplicationListener) BeanUtils.instantiateClass(clazz));
- }
- catch (Exception ex) {
- throw new ApplicationContextException("Failed to load context listener class [" + className + "]",
- ex);
- }
- }
- }
- AnnotationAwareOrderComparator.sort(listeners);
- return listeners;
- }
-
- public void setOrder(int order) {
- this.order = order;
- }
-
- @Override
- public int getOrder() {
- return this.order;
- }
-
-}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystemProperties.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystemProperties.java
index 71c2f0dd614..a339bd860d1 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystemProperties.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystemProperties.java
@@ -44,117 +44,6 @@ import org.springframework.util.StringUtils;
*/
public class LoggingSystemProperties {
- /**
- * The name of the System property that contains the process ID.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link LoggingSystemProperty#getEnvironmentVariableName()} on
- * {@link LoggingSystemProperty#PID}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String PID_KEY = LoggingSystemProperty.PID.getEnvironmentVariableName();
-
- /**
- * The name of the System property that contains the exception conversion word.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link LoggingSystemProperty#getEnvironmentVariableName()} on
- * {@link LoggingSystemProperty#EXCEPTION_CONVERSION_WORD}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String EXCEPTION_CONVERSION_WORD = LoggingSystemProperty.EXCEPTION_CONVERSION_WORD
- .getEnvironmentVariableName();
-
- /**
- * The name of the System property that contains the log file.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link LoggingSystemProperty#getEnvironmentVariableName()} on
- * {@link LoggingSystemProperty#LOG_FILE}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String LOG_FILE = LoggingSystemProperty.LOG_FILE.getEnvironmentVariableName();
-
- /**
- * The name of the System property that contains the log path.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link LoggingSystemProperty#getEnvironmentVariableName()} on
- * {@link LoggingSystemProperty#LOG_PATH}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String LOG_PATH = LoggingSystemProperty.LOG_PATH.getEnvironmentVariableName();
-
- /**
- * The name of the System property that contains the console log pattern.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link LoggingSystemProperty#getEnvironmentVariableName()} on
- * {@link LoggingSystemProperty#CONSOLE_PATTERN}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String CONSOLE_LOG_PATTERN = LoggingSystemProperty.CONSOLE_PATTERN.getEnvironmentVariableName();
-
- /**
- * The name of the System property that contains the console log charset.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link LoggingSystemProperty#getEnvironmentVariableName()} on
- * {@link LoggingSystemProperty#CONSOLE_CHARSET}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String CONSOLE_LOG_CHARSET = LoggingSystemProperty.CONSOLE_CHARSET.getEnvironmentVariableName();
-
- /**
- * The log level threshold for console log.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link LoggingSystemProperty#getEnvironmentVariableName()} on
- * {@link LoggingSystemProperty#CONSOLE_THRESHOLD}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String CONSOLE_LOG_THRESHOLD = LoggingSystemProperty.CONSOLE_THRESHOLD
- .getEnvironmentVariableName();
-
- /**
- * The name of the System property that contains the file log pattern.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link LoggingSystemProperty#getEnvironmentVariableName()} on
- * {@link LoggingSystemProperty#FILE_PATTERN}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String FILE_LOG_PATTERN = LoggingSystemProperty.FILE_PATTERN.getEnvironmentVariableName();
-
- /**
- * The name of the System property that contains the file log charset.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link LoggingSystemProperty#getEnvironmentVariableName()} on
- * {@link LoggingSystemProperty#FILE_CHARSET}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String FILE_LOG_CHARSET = LoggingSystemProperty.FILE_CHARSET.getEnvironmentVariableName();
-
- /**
- * The log level threshold for file log.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link LoggingSystemProperty#getEnvironmentVariableName()} on
- * {@link LoggingSystemProperty#FILE_THRESHOLD}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String FILE_LOG_THRESHOLD = LoggingSystemProperty.FILE_THRESHOLD.getEnvironmentVariableName();
-
- /**
- * The name of the System property that contains the log level pattern.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link LoggingSystemProperty#getEnvironmentVariableName()} on
- * {@link LoggingSystemProperty#LEVEL_PATTERN}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String LOG_LEVEL_PATTERN = LoggingSystemProperty.LEVEL_PATTERN.getEnvironmentVariableName();
-
- /**
- * The name of the System property that contains the log date-format pattern.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link LoggingSystemProperty#getEnvironmentVariableName()} on
- * {@link LoggingSystemProperty#DATEFORMAT_PATTERN}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String LOG_DATEFORMAT_PATTERN = LoggingSystemProperty.DATEFORMAT_PATTERN
- .getEnvironmentVariableName();
-
private static final BiConsumer systemPropertySetter = (name, value) -> {
if (System.getProperty(name) == null && value != null) {
System.setProperty(name, value);
@@ -300,35 +189,6 @@ public class LoggingSystemProperties {
return input;
}
- /**
- * Set a system property.
- * @param resolver the resolver used to get the property value
- * @param systemPropertyName the system property name
- * @param propertyName the application property name
- * @deprecated since 3.2.0 for removal in 3.4.0 with no replacement
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- protected final void setSystemProperty(PropertyResolver resolver, String systemPropertyName, String propertyName) {
- setSystemProperty(resolver, systemPropertyName, propertyName, null);
- }
-
- /**
- * Set a system property.
- * @param resolver the resolver used to get the property value
- * @param systemPropertyName the system property name
- * @param propertyName the application property name
- * @param defaultValue the default value if none can be resolved
- * @deprecated since 3.2.0 for removal in 3.4.0 with no replacement
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- protected final void setSystemProperty(PropertyResolver resolver, String systemPropertyName, String propertyName,
- String defaultValue) {
- String value = resolver.getProperty(propertyName);
- value = (value != null) ? value : this.defaultValueResolver.apply(systemPropertyName);
- value = (value != null) ? value : defaultValue;
- setSystemProperty(systemPropertyName, value);
- }
-
/**
* Set a system property.
* @param name the property name
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystemProperties.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystemProperties.java
index df821a47339..75ab70a9d2b 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystemProperties.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystemProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2024 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.
@@ -43,57 +43,6 @@ public class LogbackLoggingSystemProperties extends LoggingSystemProperties {
private static final boolean JBOSS_LOGGING_PRESENT = ClassUtils.isPresent("org.jboss.logging.Logger",
LogbackLoggingSystemProperties.class.getClassLoader());
- /**
- * The name of the System property that contains the rolled-over log file name
- * pattern.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link RollingPolicySystemProperty#getEnvironmentVariableName()} on
- * {@link RollingPolicySystemProperty#FILE_NAME_PATTERN}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String ROLLINGPOLICY_FILE_NAME_PATTERN = RollingPolicySystemProperty.FILE_NAME_PATTERN
- .getEnvironmentVariableName();
-
- /**
- * The name of the System property that contains the clean history on start flag.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link RollingPolicySystemProperty#getEnvironmentVariableName()} on
- * {@link RollingPolicySystemProperty#CLEAN_HISTORY_ON_START}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String ROLLINGPOLICY_CLEAN_HISTORY_ON_START = RollingPolicySystemProperty.CLEAN_HISTORY_ON_START
- .getEnvironmentVariableName();
-
- /**
- * The name of the System property that contains the file log max size.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link RollingPolicySystemProperty#getEnvironmentVariableName()} on
- * {@link RollingPolicySystemProperty#MAX_FILE_SIZE}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String ROLLINGPOLICY_MAX_FILE_SIZE = RollingPolicySystemProperty.MAX_FILE_SIZE
- .getEnvironmentVariableName();
-
- /**
- * The name of the System property that contains the file total size cap.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link RollingPolicySystemProperty#getEnvironmentVariableName()} on
- * {@link RollingPolicySystemProperty#TOTAL_SIZE_CAP}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String ROLLINGPOLICY_TOTAL_SIZE_CAP = RollingPolicySystemProperty.TOTAL_SIZE_CAP
- .getEnvironmentVariableName();
-
- /**
- * The name of the System property that contains the file log max history.
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of calling
- * {@link RollingPolicySystemProperty#getEnvironmentVariableName()} on
- * {@link RollingPolicySystemProperty#MAX_HISTORY}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public static final String ROLLINGPOLICY_MAX_HISTORY = RollingPolicySystemProperty.MAX_HISTORY
- .getEnvironmentVariableName();
-
public LogbackLoggingSystemProperties(Environment environment) {
super(environment);
}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemSslStoreBundle.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemSslStoreBundle.java
index f8f5eda84ef..7412b904e23 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemSslStoreBundle.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemSslStoreBundle.java
@@ -52,22 +52,7 @@ public class PemSslStoreBundle implements SslStoreBundle {
* @param trustStoreDetails the trust store details
*/
public PemSslStoreBundle(PemSslStoreDetails keyStoreDetails, PemSslStoreDetails trustStoreDetails) {
- this(keyStoreDetails, trustStoreDetails, null);
- }
-
- /**
- * Create a new {@link PemSslStoreBundle} instance.
- * @param keyStoreDetails the key store details
- * @param trustStoreDetails the trust store details
- * @param alias the alias to use or {@code null} to use a default alias
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of
- * {@link PemSslStoreDetails#alias()} in the {@code keyStoreDetails} and
- * {@code trustStoreDetails}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public PemSslStoreBundle(PemSslStoreDetails keyStoreDetails, PemSslStoreDetails trustStoreDetails, String alias) {
- this.keyStore = createKeyStore("key", PemSslStore.load(keyStoreDetails), alias);
- this.trustStore = createKeyStore("trust", PemSslStore.load(trustStoreDetails), alias);
+ this(PemSslStore.load(keyStoreDetails), PemSslStore.load(trustStoreDetails));
}
/**
@@ -77,12 +62,8 @@ public class PemSslStoreBundle implements SslStoreBundle {
* @since 3.2.0
*/
public PemSslStoreBundle(PemSslStore pemKeyStore, PemSslStore pemTrustStore) {
- this(pemKeyStore, pemTrustStore, null);
- }
-
- private PemSslStoreBundle(PemSslStore pemKeyStore, PemSslStore pemTrustStore, String alias) {
- this.keyStore = createKeyStore("key", pemKeyStore, alias);
- this.trustStore = createKeyStore("trust", pemTrustStore, alias);
+ this.keyStore = createKeyStore("key", pemKeyStore);
+ this.trustStore = createKeyStore("trust", pemTrustStore);
}
@Override
@@ -100,14 +81,13 @@ public class PemSslStoreBundle implements SslStoreBundle {
return this.trustStore;
}
- private static KeyStore createKeyStore(String name, PemSslStore pemSslStore, String alias) {
+ private static KeyStore createKeyStore(String name, PemSslStore pemSslStore) {
if (pemSslStore == null) {
return null;
}
try {
Assert.notEmpty(pemSslStore.certificates(), "Certificates must not be empty");
- alias = (pemSslStore.alias() != null) ? pemSslStore.alias() : alias;
- alias = (alias != null) ? alias : DEFAULT_ALIAS;
+ String alias = (pemSslStore.alias() != null) ? pemSslStore.alias() : DEFAULT_ALIAS;
KeyStore store = createKeyStore(pemSslStore.type());
List certificates = pemSslStore.certificates();
PrivateKey privateKey = pemSslStore.privateKey();
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemSslStoreDetails.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemSslStoreDetails.java
index 2f7dfff29c1..0b1bdbcd6f1 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemSslStoreDetails.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemSslStoreDetails.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2024 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.
@@ -89,16 +89,6 @@ public record PemSslStoreDetails(String type, String alias, String password, Str
this(type, certificate, privateKey, null);
}
- /**
- * Return the certificate content.
- * @return the certificate content
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of {@link #certificates()}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public String certificate() {
- return certificates();
- }
-
/**
* Return a new {@link PemSslStoreDetails} instance with a new alias.
* @param alias the new alias
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorBuilder.java
deleted file mode 100644
index 304b9ce9320..00000000000
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorBuilder.java
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * Copyright 2012-2023 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.task;
-
-import java.time.Duration;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import org.springframework.beans.BeanUtils;
-import org.springframework.boot.context.properties.PropertyMapper;
-import org.springframework.core.task.TaskDecorator;
-import org.springframework.core.task.TaskExecutor;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-import org.springframework.util.Assert;
-import org.springframework.util.CollectionUtils;
-
-/**
- * Builder that can be used to configure and create a {@link TaskExecutor}. Provides
- * convenience methods to set common {@link ThreadPoolTaskExecutor} settings and register
- * {@link #taskDecorator(TaskDecorator)}). For advanced configuration, consider using
- * {@link TaskExecutorCustomizer}.
- *
- * In a typical auto-configured Spring Boot application this builder is available as a
- * bean and can be injected whenever a {@link TaskExecutor} is needed.
- *
- * @author Stephane Nicoll
- * @author Filip Hrisafov
- * @since 2.1.0
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of
- * {@link ThreadPoolTaskExecutorBuilder}
- */
-@Deprecated(since = "3.2.0", forRemoval = true)
-@SuppressWarnings("removal")
-public class TaskExecutorBuilder {
-
- private final Integer queueCapacity;
-
- private final Integer corePoolSize;
-
- private final Integer maxPoolSize;
-
- private final Boolean allowCoreThreadTimeOut;
-
- private final Duration keepAlive;
-
- private final Boolean awaitTermination;
-
- private final Duration awaitTerminationPeriod;
-
- private final String threadNamePrefix;
-
- private final TaskDecorator taskDecorator;
-
- private final Set customizers;
-
- public TaskExecutorBuilder() {
- this.queueCapacity = null;
- this.corePoolSize = null;
- this.maxPoolSize = null;
- this.allowCoreThreadTimeOut = null;
- this.keepAlive = null;
- this.awaitTermination = null;
- this.awaitTerminationPeriod = null;
- this.threadNamePrefix = null;
- this.taskDecorator = null;
- this.customizers = null;
- }
-
- private TaskExecutorBuilder(Integer queueCapacity, Integer corePoolSize, Integer maxPoolSize,
- Boolean allowCoreThreadTimeOut, Duration keepAlive, Boolean awaitTermination,
- Duration awaitTerminationPeriod, String threadNamePrefix, TaskDecorator taskDecorator,
- Set customizers) {
- this.queueCapacity = queueCapacity;
- this.corePoolSize = corePoolSize;
- this.maxPoolSize = maxPoolSize;
- this.allowCoreThreadTimeOut = allowCoreThreadTimeOut;
- this.keepAlive = keepAlive;
- this.awaitTermination = awaitTermination;
- this.awaitTerminationPeriod = awaitTerminationPeriod;
- this.threadNamePrefix = threadNamePrefix;
- this.taskDecorator = taskDecorator;
- this.customizers = customizers;
- }
-
- /**
- * Set the capacity of the queue. An unbounded capacity does not increase the pool and
- * therefore ignores {@link #maxPoolSize(int) maxPoolSize}.
- * @param queueCapacity the queue capacity to set
- * @return a new builder instance
- */
- public TaskExecutorBuilder queueCapacity(int queueCapacity) {
- return new TaskExecutorBuilder(queueCapacity, this.corePoolSize, this.maxPoolSize, this.allowCoreThreadTimeOut,
- this.keepAlive, this.awaitTermination, this.awaitTerminationPeriod, this.threadNamePrefix,
- this.taskDecorator, this.customizers);
- }
-
- /**
- * Set the core number of threads. Effectively that maximum number of threads as long
- * as the queue is not full.
- *
- * Core threads can grow and shrink if {@link #allowCoreThreadTimeOut(boolean)} is
- * enabled.
- * @param corePoolSize the core pool size to set
- * @return a new builder instance
- */
- public TaskExecutorBuilder corePoolSize(int corePoolSize) {
- return new TaskExecutorBuilder(this.queueCapacity, corePoolSize, this.maxPoolSize, this.allowCoreThreadTimeOut,
- this.keepAlive, this.awaitTermination, this.awaitTerminationPeriod, this.threadNamePrefix,
- this.taskDecorator, this.customizers);
- }
-
- /**
- * Set the maximum allowed number of threads. When the {@link #queueCapacity(int)
- * queue} is full, the pool can expand up to that size to accommodate the load.
- *
- * If the {@link #queueCapacity(int) queue capacity} is unbounded, this setting is
- * ignored.
- * @param maxPoolSize the max pool size to set
- * @return a new builder instance
- */
- public TaskExecutorBuilder maxPoolSize(int maxPoolSize) {
- return new TaskExecutorBuilder(this.queueCapacity, this.corePoolSize, maxPoolSize, this.allowCoreThreadTimeOut,
- this.keepAlive, this.awaitTermination, this.awaitTerminationPeriod, this.threadNamePrefix,
- this.taskDecorator, this.customizers);
- }
-
- /**
- * Set whether core threads are allowed to time out. When enabled, this enables
- * dynamic growing and shrinking of the pool.
- * @param allowCoreThreadTimeOut if core threads are allowed to time out
- * @return a new builder instance
- */
- public TaskExecutorBuilder allowCoreThreadTimeOut(boolean allowCoreThreadTimeOut) {
- return new TaskExecutorBuilder(this.queueCapacity, this.corePoolSize, this.maxPoolSize, allowCoreThreadTimeOut,
- this.keepAlive, this.awaitTermination, this.awaitTerminationPeriod, this.threadNamePrefix,
- this.taskDecorator, this.customizers);
- }
-
- /**
- * Set the time limit for which threads may remain idle before being terminated.
- * @param keepAlive the keep alive to set
- * @return a new builder instance
- */
- public TaskExecutorBuilder keepAlive(Duration keepAlive) {
- return new TaskExecutorBuilder(this.queueCapacity, this.corePoolSize, this.maxPoolSize,
- this.allowCoreThreadTimeOut, keepAlive, this.awaitTermination, this.awaitTerminationPeriod,
- this.threadNamePrefix, this.taskDecorator, this.customizers);
- }
-
- /**
- * Set whether the executor should wait for scheduled tasks to complete on shutdown,
- * not interrupting running tasks and executing all tasks in the queue.
- * @param awaitTermination whether the executor needs to wait for the tasks to
- * complete on shutdown
- * @return a new builder instance
- * @see #awaitTerminationPeriod(Duration)
- */
- public TaskExecutorBuilder awaitTermination(boolean awaitTermination) {
- return new TaskExecutorBuilder(this.queueCapacity, this.corePoolSize, this.maxPoolSize,
- this.allowCoreThreadTimeOut, this.keepAlive, awaitTermination, this.awaitTerminationPeriod,
- this.threadNamePrefix, this.taskDecorator, this.customizers);
- }
-
- /**
- * Set the maximum time the executor is supposed to block on shutdown. When set, the
- * executor blocks on shutdown in order to wait for remaining tasks to complete their
- * execution before the rest of the container continues to shut down. This is
- * particularly useful if your remaining tasks are likely to need access to other
- * resources that are also managed by the container.
- * @param awaitTerminationPeriod the await termination period to set
- * @return a new builder instance
- */
- public TaskExecutorBuilder awaitTerminationPeriod(Duration awaitTerminationPeriod) {
- return new TaskExecutorBuilder(this.queueCapacity, this.corePoolSize, this.maxPoolSize,
- this.allowCoreThreadTimeOut, this.keepAlive, this.awaitTermination, awaitTerminationPeriod,
- this.threadNamePrefix, this.taskDecorator, this.customizers);
- }
-
- /**
- * Set the prefix to use for the names of newly created threads.
- * @param threadNamePrefix the thread name prefix to set
- * @return a new builder instance
- */
- public TaskExecutorBuilder threadNamePrefix(String threadNamePrefix) {
- return new TaskExecutorBuilder(this.queueCapacity, this.corePoolSize, this.maxPoolSize,
- this.allowCoreThreadTimeOut, this.keepAlive, this.awaitTermination, this.awaitTerminationPeriod,
- threadNamePrefix, this.taskDecorator, this.customizers);
- }
-
- /**
- * Set the {@link TaskDecorator} to use or {@code null} to not use any.
- * @param taskDecorator the task decorator to use
- * @return a new builder instance
- */
- public TaskExecutorBuilder taskDecorator(TaskDecorator taskDecorator) {
- return new TaskExecutorBuilder(this.queueCapacity, this.corePoolSize, this.maxPoolSize,
- this.allowCoreThreadTimeOut, this.keepAlive, this.awaitTermination, this.awaitTerminationPeriod,
- this.threadNamePrefix, taskDecorator, this.customizers);
- }
-
- /**
- * Set the {@link TaskExecutorCustomizer TaskExecutorCustomizers} that should be
- * applied to the {@link ThreadPoolTaskExecutor}. Customizers are applied in the order
- * that they were added after builder configuration has been applied. Setting this
- * value will replace any previously configured customizers.
- * @param customizers the customizers to set
- * @return a new builder instance
- * @see #additionalCustomizers(TaskExecutorCustomizer...)
- */
- public TaskExecutorBuilder customizers(TaskExecutorCustomizer... customizers) {
- Assert.notNull(customizers, "Customizers must not be null");
- return customizers(Arrays.asList(customizers));
- }
-
- /**
- * Set the {@link TaskExecutorCustomizer TaskExecutorCustomizers} that should be
- * applied to the {@link ThreadPoolTaskExecutor}. Customizers are applied in the order
- * that they were added after builder configuration has been applied. Setting this
- * value will replace any previously configured customizers.
- * @param customizers the customizers to set
- * @return a new builder instance
- * @see #additionalCustomizers(TaskExecutorCustomizer...)
- */
- public TaskExecutorBuilder customizers(Iterable customizers) {
- Assert.notNull(customizers, "Customizers must not be null");
- return new TaskExecutorBuilder(this.queueCapacity, this.corePoolSize, this.maxPoolSize,
- this.allowCoreThreadTimeOut, this.keepAlive, this.awaitTermination, this.awaitTerminationPeriod,
- this.threadNamePrefix, this.taskDecorator, append(null, customizers));
- }
-
- /**
- * Add {@link TaskExecutorCustomizer TaskExecutorCustomizers} that should be applied
- * to the {@link ThreadPoolTaskExecutor}. Customizers are applied in the order that
- * they were added after builder configuration has been applied.
- * @param customizers the customizers to add
- * @return a new builder instance
- * @see #customizers(TaskExecutorCustomizer...)
- */
- public TaskExecutorBuilder additionalCustomizers(TaskExecutorCustomizer... customizers) {
- Assert.notNull(customizers, "Customizers must not be null");
- return additionalCustomizers(Arrays.asList(customizers));
- }
-
- /**
- * Add {@link TaskExecutorCustomizer TaskExecutorCustomizers} that should be applied
- * to the {@link ThreadPoolTaskExecutor}. Customizers are applied in the order that
- * they were added after builder configuration has been applied.
- * @param customizers the customizers to add
- * @return a new builder instance
- * @see #customizers(TaskExecutorCustomizer...)
- */
- public TaskExecutorBuilder additionalCustomizers(Iterable customizers) {
- Assert.notNull(customizers, "Customizers must not be null");
- return new TaskExecutorBuilder(this.queueCapacity, this.corePoolSize, this.maxPoolSize,
- this.allowCoreThreadTimeOut, this.keepAlive, this.awaitTermination, this.awaitTerminationPeriod,
- this.threadNamePrefix, this.taskDecorator, append(this.customizers, customizers));
- }
-
- /**
- * Build a new {@link ThreadPoolTaskExecutor} instance and configure it using this
- * builder.
- * @return a configured {@link ThreadPoolTaskExecutor} instance.
- * @see #build(Class)
- * @see #configure(ThreadPoolTaskExecutor)
- */
- public ThreadPoolTaskExecutor build() {
- return configure(new ThreadPoolTaskExecutor());
- }
-
- /**
- * Build a new {@link ThreadPoolTaskExecutor} instance of the specified type and
- * configure it using this builder.
- * @param the type of task executor
- * @param taskExecutorClass the template type to create
- * @return a configured {@link ThreadPoolTaskExecutor} instance.
- * @see #build()
- * @see #configure(ThreadPoolTaskExecutor)
- */
- public T build(Class taskExecutorClass) {
- return configure(BeanUtils.instantiateClass(taskExecutorClass));
- }
-
- /**
- * Configure the provided {@link ThreadPoolTaskExecutor} instance using this builder.
- * @param the type of task executor
- * @param taskExecutor the {@link ThreadPoolTaskExecutor} to configure
- * @return the task executor instance
- * @see #build()
- * @see #build(Class)
- */
- public T configure(T taskExecutor) {
- PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
- map.from(this.queueCapacity).to(taskExecutor::setQueueCapacity);
- map.from(this.corePoolSize).to(taskExecutor::setCorePoolSize);
- map.from(this.maxPoolSize).to(taskExecutor::setMaxPoolSize);
- map.from(this.keepAlive).asInt(Duration::getSeconds).to(taskExecutor::setKeepAliveSeconds);
- map.from(this.allowCoreThreadTimeOut).to(taskExecutor::setAllowCoreThreadTimeOut);
- map.from(this.awaitTermination).to(taskExecutor::setWaitForTasksToCompleteOnShutdown);
- map.from(this.awaitTerminationPeriod).as(Duration::toMillis).to(taskExecutor::setAwaitTerminationMillis);
- map.from(this.threadNamePrefix).whenHasText().to(taskExecutor::setThreadNamePrefix);
- map.from(this.taskDecorator).to(taskExecutor::setTaskDecorator);
- if (!CollectionUtils.isEmpty(this.customizers)) {
- this.customizers.forEach((customizer) -> customizer.customize(taskExecutor));
- }
- return taskExecutor;
- }
-
- private Set append(Set set, Iterable extends T> additions) {
- Set result = new LinkedHashSet<>((set != null) ? set : Collections.emptySet());
- additions.forEach(result::add);
- return Collections.unmodifiableSet(result);
- }
-
-}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorCustomizer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorCustomizer.java
deleted file mode 100644
index 0ff969caaba..00000000000
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorCustomizer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2012-2023 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.task;
-
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-
-/**
- * Callback interface that can be used to customize a {@link ThreadPoolTaskExecutor}.
- *
- * @author Stephane Nicoll
- * @since 2.1.0
- * @see TaskExecutorBuilder
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of
- * {@link ThreadPoolTaskExecutorCustomizer}
- */
-@FunctionalInterface
-@Deprecated(since = "3.2.0", forRemoval = true)
-public interface TaskExecutorCustomizer {
-
- /**
- * Callback to customize a {@link ThreadPoolTaskExecutor} instance.
- * @param taskExecutor the task executor to customize
- */
- void customize(ThreadPoolTaskExecutor taskExecutor);
-
-}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerBuilder.java
deleted file mode 100644
index 65c385d0c5a..00000000000
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerBuilder.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright 2012-2023 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.task;
-
-import java.time.Duration;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import org.springframework.boot.context.properties.PropertyMapper;
-import org.springframework.scheduling.TaskScheduler;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
-import org.springframework.util.Assert;
-import org.springframework.util.CollectionUtils;
-
-/**
- * Builder that can be used to configure and create a {@link TaskScheduler}. Provides
- * convenience methods to set common {@link ThreadPoolTaskScheduler} settings. For
- * advanced configuration, consider using {@link TaskSchedulerCustomizer}.
- *
- * In a typical auto-configured Spring Boot application this builder is available as a
- * bean and can be injected whenever a {@link TaskScheduler} is needed.
- *
- * @author Stephane Nicoll
- * @since 2.1.0
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of
- * {@link ThreadPoolTaskSchedulerBuilder}
- */
-@Deprecated(since = "3.2.0", forRemoval = true)
-@SuppressWarnings("removal")
-public class TaskSchedulerBuilder {
-
- private final Integer poolSize;
-
- private final Boolean awaitTermination;
-
- private final Duration awaitTerminationPeriod;
-
- private final String threadNamePrefix;
-
- private final Set customizers;
-
- public TaskSchedulerBuilder() {
- this.poolSize = null;
- this.awaitTermination = null;
- this.awaitTerminationPeriod = null;
- this.threadNamePrefix = null;
- this.customizers = null;
- }
-
- public TaskSchedulerBuilder(Integer poolSize, Boolean awaitTermination, Duration awaitTerminationPeriod,
- String threadNamePrefix, Set taskSchedulerCustomizers) {
- this.poolSize = poolSize;
- this.awaitTermination = awaitTermination;
- this.awaitTerminationPeriod = awaitTerminationPeriod;
- this.threadNamePrefix = threadNamePrefix;
- this.customizers = taskSchedulerCustomizers;
- }
-
- /**
- * Set the maximum allowed number of threads.
- * @param poolSize the pool size to set
- * @return a new builder instance
- */
- public TaskSchedulerBuilder poolSize(int poolSize) {
- return new TaskSchedulerBuilder(poolSize, this.awaitTermination, this.awaitTerminationPeriod,
- this.threadNamePrefix, this.customizers);
- }
-
- /**
- * Set whether the executor should wait for scheduled tasks to complete on shutdown,
- * not interrupting running tasks and executing all tasks in the queue.
- * @param awaitTermination whether the executor needs to wait for the tasks to
- * complete on shutdown
- * @return a new builder instance
- * @see #awaitTerminationPeriod(Duration)
- */
- public TaskSchedulerBuilder awaitTermination(boolean awaitTermination) {
- return new TaskSchedulerBuilder(this.poolSize, awaitTermination, this.awaitTerminationPeriod,
- this.threadNamePrefix, this.customizers);
- }
-
- /**
- * Set the maximum time the executor is supposed to block on shutdown. When set, the
- * executor blocks on shutdown in order to wait for remaining tasks to complete their
- * execution before the rest of the container continues to shut down. This is
- * particularly useful if your remaining tasks are likely to need access to other
- * resources that are also managed by the container.
- * @param awaitTerminationPeriod the await termination period to set
- * @return a new builder instance
- */
- public TaskSchedulerBuilder awaitTerminationPeriod(Duration awaitTerminationPeriod) {
- return new TaskSchedulerBuilder(this.poolSize, this.awaitTermination, awaitTerminationPeriod,
- this.threadNamePrefix, this.customizers);
- }
-
- /**
- * Set the prefix to use for the names of newly created threads.
- * @param threadNamePrefix the thread name prefix to set
- * @return a new builder instance
- */
- public TaskSchedulerBuilder threadNamePrefix(String threadNamePrefix) {
- return new TaskSchedulerBuilder(this.poolSize, this.awaitTermination, this.awaitTerminationPeriod,
- threadNamePrefix, this.customizers);
- }
-
- /**
- * Set the {@link TaskSchedulerCustomizer TaskSchedulerCustomizers} that should be
- * applied to the {@link ThreadPoolTaskScheduler}. Customizers are applied in the
- * order that they were added after builder configuration has been applied. Setting
- * this value will replace any previously configured customizers.
- * @param customizers the customizers to set
- * @return a new builder instance
- * @see #additionalCustomizers(TaskSchedulerCustomizer...)
- */
- public TaskSchedulerBuilder customizers(TaskSchedulerCustomizer... customizers) {
- Assert.notNull(customizers, "Customizers must not be null");
- return customizers(Arrays.asList(customizers));
- }
-
- /**
- * Set the {@link TaskSchedulerCustomizer taskSchedulerCustomizers} that should be
- * applied to the {@link ThreadPoolTaskScheduler}. Customizers are applied in the
- * order that they were added after builder configuration has been applied. Setting
- * this value will replace any previously configured customizers.
- * @param customizers the customizers to set
- * @return a new builder instance
- * @see #additionalCustomizers(TaskSchedulerCustomizer...)
- */
- public TaskSchedulerBuilder customizers(Iterable customizers) {
- Assert.notNull(customizers, "Customizers must not be null");
- return new TaskSchedulerBuilder(this.poolSize, this.awaitTermination, this.awaitTerminationPeriod,
- this.threadNamePrefix, append(null, customizers));
- }
-
- /**
- * Add {@link TaskSchedulerCustomizer taskSchedulerCustomizers} that should be applied
- * to the {@link ThreadPoolTaskScheduler}. Customizers are applied in the order that
- * they were added after builder configuration has been applied.
- * @param customizers the customizers to add
- * @return a new builder instance
- * @see #customizers(TaskSchedulerCustomizer...)
- */
- public TaskSchedulerBuilder additionalCustomizers(TaskSchedulerCustomizer... customizers) {
- Assert.notNull(customizers, "Customizers must not be null");
- return additionalCustomizers(Arrays.asList(customizers));
- }
-
- /**
- * Add {@link TaskSchedulerCustomizer taskSchedulerCustomizers} that should be applied
- * to the {@link ThreadPoolTaskScheduler}. Customizers are applied in the order that
- * they were added after builder configuration has been applied.
- * @param customizers the customizers to add
- * @return a new builder instance
- * @see #customizers(TaskSchedulerCustomizer...)
- */
- public TaskSchedulerBuilder additionalCustomizers(Iterable customizers) {
- Assert.notNull(customizers, "Customizers must not be null");
- return new TaskSchedulerBuilder(this.poolSize, this.awaitTermination, this.awaitTerminationPeriod,
- this.threadNamePrefix, append(this.customizers, customizers));
- }
-
- /**
- * Build a new {@link ThreadPoolTaskScheduler} instance and configure it using this
- * builder.
- * @return a configured {@link ThreadPoolTaskScheduler} instance.
- * @see #configure(ThreadPoolTaskScheduler)
- */
- public ThreadPoolTaskScheduler build() {
- return configure(new ThreadPoolTaskScheduler());
- }
-
- /**
- * Configure the provided {@link ThreadPoolTaskScheduler} instance using this builder.
- * @param the type of task scheduler
- * @param taskScheduler the {@link ThreadPoolTaskScheduler} to configure
- * @return the task scheduler instance
- * @see #build()
- */
- public T configure(T taskScheduler) {
- PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
- map.from(this.poolSize).to(taskScheduler::setPoolSize);
- map.from(this.awaitTermination).to(taskScheduler::setWaitForTasksToCompleteOnShutdown);
- map.from(this.awaitTerminationPeriod).asInt(Duration::getSeconds).to(taskScheduler::setAwaitTerminationSeconds);
- map.from(this.threadNamePrefix).to(taskScheduler::setThreadNamePrefix);
- if (!CollectionUtils.isEmpty(this.customizers)) {
- this.customizers.forEach((customizer) -> customizer.customize(taskScheduler));
- }
- return taskScheduler;
- }
-
- private Set append(Set set, Iterable extends T> additions) {
- Set result = new LinkedHashSet<>((set != null) ? set : Collections.emptySet());
- additions.forEach(result::add);
- return Collections.unmodifiableSet(result);
- }
-
-}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerCustomizer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerCustomizer.java
deleted file mode 100644
index 8acf391a42a..00000000000
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerCustomizer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2012-2023 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.task;
-
-import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
-
-/**
- * Callback interface that can be used to customize a {@link ThreadPoolTaskScheduler}.
- *
- * @author Stephane Nicoll
- * @since 2.1.0
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of
- * {@link ThreadPoolTaskSchedulerCustomizer}
- */
-@FunctionalInterface
-@Deprecated(since = "3.2.0", forRemoval = true)
-public interface TaskSchedulerCustomizer {
-
- /**
- * Callback to customize a {@link ThreadPoolTaskScheduler} instance.
- * @param taskScheduler the task scheduler to customize
- */
- void customize(ThreadPoolTaskScheduler taskScheduler);
-
-}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactorySettings.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactorySettings.java
index 204acffb933..f7dd4af2de8 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactorySettings.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactorySettings.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2024 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.
@@ -40,36 +40,7 @@ public record ClientHttpRequestFactorySettings(Duration connectTimeout, Duration
* the implementation.
*/
public static final ClientHttpRequestFactorySettings DEFAULTS = new ClientHttpRequestFactorySettings(null, null,
- null, null);
-
- /**
- * Create a new {@link ClientHttpRequestFactorySettings} instance.
- * @param connectTimeout the connection timeout
- * @param readTimeout the read timeout
- * @param bufferRequestBody if request body buffering is used
- * @deprecated since 3.2.0 for removal in 3.4.0 as support for buffering has been
- * removed in Spring Framework 6.1
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public ClientHttpRequestFactorySettings(Duration connectTimeout, Duration readTimeout, Boolean bufferRequestBody) {
- this(connectTimeout, readTimeout, (SslBundle) null);
- }
-
- /**
- * Create a new {@link ClientHttpRequestFactorySettings} instance.
- * @param connectTimeout the connection timeout
- * @param readTimeout the read timeout
- * @param bufferRequestBody if request body buffering is used
- * @param sslBundle the ssl bundle
- * @since 3.1.0
- * @deprecated since 3.2.0 for removal in 3.4.0 as support for buffering has been
- * removed in Spring Framework 6.1
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public ClientHttpRequestFactorySettings(Duration connectTimeout, Duration readTimeout, Boolean bufferRequestBody,
- SslBundle sslBundle) {
- this(connectTimeout, readTimeout, sslBundle);
- }
+ null);
/**
* Return a new {@link ClientHttpRequestFactorySettings} instance with an updated
@@ -92,18 +63,6 @@ public record ClientHttpRequestFactorySettings(Duration connectTimeout, Duration
return new ClientHttpRequestFactorySettings(this.connectTimeout, readTimeout, this.sslBundle);
}
- /**
- * Has no effect as support for buffering has been removed in Spring Framework 6.1.
- * @param bufferRequestBody the new buffer request body setting
- * @return a new {@link ClientHttpRequestFactorySettings} instance
- * @deprecated since 3.2.0 for removal in 3.4.0 as support for buffering has been
- * removed in Spring Framework 6.1
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public ClientHttpRequestFactorySettings withBufferRequestBody(Boolean bufferRequestBody) {
- return this;
- }
-
/**
* Return a new {@link ClientHttpRequestFactorySettings} instance with an updated SSL
* bundle setting.
@@ -115,15 +74,4 @@ public record ClientHttpRequestFactorySettings(Duration connectTimeout, Duration
return new ClientHttpRequestFactorySettings(this.connectTimeout, this.readTimeout, sslBundle);
}
- /**
- * Returns whether request body buffering is used.
- * @return whether request body buffering is used
- * @deprecated since 3.2.0 for removal in 3.4.0 as support for buffering has been
- * removed in Spring Framework 6.1
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public Boolean bufferRequestBody() {
- return null;
- }
-
}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java
index 49d8ac59f60..59baed729a1 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java
@@ -35,8 +35,6 @@ import org.springframework.boot.ssl.SslBundle;
import org.springframework.http.client.ClientHttpRequest;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequestInterceptor;
-import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
-import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
@@ -436,21 +434,6 @@ public class RestTemplateBuilder {
this.customizers, this.requestCustomizers);
}
- /**
- * Has no effect as support for buffering has been removed in Spring Framework 6.1.
- * @param bufferRequestBody value of the bufferRequestBody parameter
- * @return a new builder instance.
- * @since 2.2.0
- * @deprecated since 3.2.0 for removal in 3.4.0 as support for buffering has been
- * removed in Spring Framework 6.1
- * @see SimpleClientHttpRequestFactory#setBufferRequestBody(boolean)
- * @see HttpComponentsClientHttpRequestFactory#setBufferRequestBody(boolean)
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public RestTemplateBuilder setBufferRequestBody(boolean bufferRequestBody) {
- return this;
- }
-
/**
* Sets the SSL bundle on the underlying {@link ClientHttpRequestFactory}.
* @param sslBundle the SSL bundle
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RootUriBuilderFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RootUriBuilderFactory.java
index da2945a7f47..2b3eebab32a 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RootUriBuilderFactory.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RootUriBuilderFactory.java
@@ -31,12 +31,6 @@ import org.springframework.web.util.UriTemplateHandler;
*/
public class RootUriBuilderFactory extends RootUriTemplateHandler implements UriBuilderFactory {
- @SuppressWarnings("removal")
- RootUriBuilderFactory(String rootUri) {
- super(rootUri);
- }
-
- @SuppressWarnings("removal")
RootUriBuilderFactory(String rootUri, UriTemplateHandler delegate) {
super(rootUri, delegate);
}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RootUriTemplateHandler.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RootUriTemplateHandler.java
index 4a007a6fcaa..763edee26cc 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RootUriTemplateHandler.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RootUriTemplateHandler.java
@@ -18,12 +18,9 @@ package org.springframework.boot.web.client;
import java.net.URI;
import java.util.Map;
-import java.util.function.Function;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
-import org.springframework.web.client.RestTemplate;
-import org.springframework.web.util.DefaultUriBuilderFactory;
import org.springframework.web.util.UriTemplateHandler;
/**
@@ -45,24 +42,7 @@ public class RootUriTemplateHandler implements UriTemplateHandler {
this.handler = handler;
}
- /**
- * Create a new {@link RootUriTemplateHandler} instance.
- * @param rootUri the root URI to be used to prefix relative URLs
- * @deprecated since 3.2.3 for removal in 3.4.0, with no replacement
- */
- @Deprecated(since = "3.2.3", forRemoval = true)
- public RootUriTemplateHandler(String rootUri) {
- this(rootUri, new DefaultUriBuilderFactory());
- }
-
- /**
- * Create a new {@link RootUriTemplateHandler} instance.
- * @param rootUri the root URI to be used to prefix relative URLs
- * @param handler the handler handler
- * @deprecated since 3.2.3 for removal in 3.4.0, with no replacement
- */
- @Deprecated(since = "3.2.3", forRemoval = true)
- public RootUriTemplateHandler(String rootUri, UriTemplateHandler handler) {
+ RootUriTemplateHandler(String rootUri, UriTemplateHandler handler) {
Assert.notNull(rootUri, "RootUri must not be null");
Assert.notNull(handler, "Handler must not be null");
this.rootUri = rootUri;
@@ -90,32 +70,4 @@ public class RootUriTemplateHandler implements UriTemplateHandler {
return this.rootUri;
}
- /**
- * Derives a new {@code RootUriTemplateHandler} from this one, wrapping its delegate
- * {@link UriTemplateHandler} by applying the given {@code wrapper}.
- * @param wrapper the wrapper to apply to the delegate URI template handler
- * @return the new handler
- * @since 2.3.10
- * @deprecated since 3.2.3 for removal in 3.4.0, with no replacement
- */
- @Deprecated(since = "3.2.3", forRemoval = true)
- public RootUriTemplateHandler withHandlerWrapper(Function wrapper) {
- return new RootUriTemplateHandler(getRootUri(), wrapper.apply(this.handler));
- }
-
- /**
- * Add a {@link RootUriTemplateHandler} instance to the given {@link RestTemplate}.
- * @param restTemplate the {@link RestTemplate} to add the handler to
- * @param rootUri the root URI
- * @return the added {@link RootUriTemplateHandler}.
- * @deprecated since 3.2.3 for removal in 3.4.0, with no replacement
- */
- @Deprecated(since = "3.2.3", forRemoval = true)
- public static RootUriTemplateHandler addTo(RestTemplate restTemplate, String rootUri) {
- Assert.notNull(restTemplate, "RestTemplate must not be null");
- RootUriTemplateHandler handler = new RootUriTemplateHandler(rootUri, restTemplate.getUriTemplateHandler());
- restTemplate.setUriTemplateHandler(handler);
- return handler;
- }
-
}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyWebServer.java
index 3c1d68a0528..87f8ba2fd32 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyWebServer.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyWebServer.java
@@ -82,21 +82,6 @@ public class NettyWebServer implements WebServer {
private volatile DisposableServer disposableServer;
- /**
- * Creates a new {@code NettyWebServer} instance.
- * @param httpServer the HTTP server
- * @param handlerAdapter the handler adapter
- * @param lifecycleTimeout the lifecycle timeout, may be {@code null}
- * @param shutdown the shutdown, may be {@code null}
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of
- * {@link #NettyWebServer(HttpServer, ReactorHttpHandlerAdapter, Duration, Shutdown, ReactorResourceFactory)}
- */
- @Deprecated(since = "3.2.0", forRemoval = true)
- public NettyWebServer(HttpServer httpServer, ReactorHttpHandlerAdapter handlerAdapter, Duration lifecycleTimeout,
- Shutdown shutdown) {
- this(httpServer, handlerAdapter, lifecycleTimeout, shutdown, null);
- }
-
/**
* Creates a new {@code NettyWebServer} instance.
* @param httpServer the HTTP server
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/SslServerCustomizer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/SslServerCustomizer.java
index 8bfda0671cb..02590287687 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/SslServerCustomizer.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/SslServerCustomizer.java
@@ -106,17 +106,6 @@ public class SslServerCustomizer implements NettyServerCustomizer {
return SslProvider.builder().sslContext((GenericSslContextSpec>) createSslContextSpec(sslBundle)).build();
}
- /**
- * Factory method used to create an {@link AbstractProtocolSslContextSpec}.
- * @return the {@link AbstractProtocolSslContextSpec} to use
- * @deprecated since 3.2.0 for removal in 3.4.0 in favor of
- * {@link #createSslContextSpec(SslBundle)}
- */
- @Deprecated(since = "3.2", forRemoval = true)
- protected AbstractProtocolSslContextSpec> createSslContextSpec() {
- return createSslContextSpec(this.sslBundle);
- }
-
/**
* Create an {@link AbstractProtocolSslContextSpec} for a given {@link SslBundle}.
* @param sslBundle the {@link SslBundle} to use
diff --git a/spring-boot-project/spring-boot/src/main/resources/META-INF/spring.factories b/spring-boot-project/spring-boot/src/main/resources/META-INF/spring.factories
index ac63bd80050..af78eab2294 100644
--- a/spring-boot-project/spring-boot/src/main/resources/META-INF/spring.factories
+++ b/spring-boot-project/spring-boot/src/main/resources/META-INF/spring.factories
@@ -36,7 +36,6 @@ org.springframework.boot.diagnostics.FailureAnalyzers
org.springframework.context.ApplicationContextInitializer=\
org.springframework.boot.context.ConfigurationWarningsApplicationContextInitializer,\
org.springframework.boot.context.ContextIdApplicationContextInitializer,\
-org.springframework.boot.context.config.DelegatingApplicationContextInitializer,\
org.springframework.boot.rsocket.context.RSocketPortInfoApplicationContextInitializer,\
org.springframework.boot.web.context.ServerPortInfoApplicationContextInitializer
@@ -46,7 +45,6 @@ org.springframework.boot.ClearCachesApplicationListener,\
org.springframework.boot.builder.ParentContextCloserApplicationListener,\
org.springframework.boot.context.FileEncodingApplicationListener,\
org.springframework.boot.context.config.AnsiOutputApplicationListener,\
-org.springframework.boot.context.config.DelegatingApplicationListener,\
org.springframework.boot.context.logging.LoggingApplicationListener,\
org.springframework.boot.env.EnvironmentPostProcessorApplicationListener
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java
index 81897b33a21..c78c6fc3453 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2024 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.
@@ -265,7 +265,7 @@ class SpringApplicationBuilderTests {
SpringApplicationBuilder application = new SpringApplicationBuilder(ExampleConfig.class)
.web(WebApplicationType.NONE);
this.context = application.run();
- assertThat(application.application().getInitializers()).hasSize(5);
+ assertThat(application.application().getInitializers()).hasSize(4);
}
@Test
@@ -274,7 +274,7 @@ class SpringApplicationBuilderTests {
.child(ChildConfig.class)
.web(WebApplicationType.NONE);
this.context = application.run();
- assertThat(application.application().getInitializers()).hasSize(6);
+ assertThat(application.application().getInitializers()).hasSize(5);
}
@Test
@@ -284,7 +284,7 @@ class SpringApplicationBuilderTests {
.initializers((ConfigurableApplicationContext applicationContext) -> {
});
this.context = application.run();
- assertThat(application.application().getInitializers()).hasSize(6);
+ assertThat(application.application().getInitializers()).hasSize(5);
}
@Test
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java
deleted file mode 100644
index 2436489db8b..00000000000
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2012-2023 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.context.config;
-
-import org.junit.jupiter.api.Test;
-
-import org.springframework.context.ApplicationContextException;
-import org.springframework.context.ApplicationContextInitializer;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.support.StaticApplicationContext;
-import org.springframework.core.Ordered;
-import org.springframework.core.annotation.Order;
-import org.springframework.test.context.support.TestPropertySourceUtils;
-import org.springframework.web.context.ConfigurableWebApplicationContext;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
-import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
-
-/**
- * Tests for {@link DelegatingApplicationContextInitializer}.
- *
- * @author Phillip Webb
- */
-@Deprecated(since = "3.2.0", forRemoval = true)
-@SuppressWarnings("removal")
-class DelegatingApplicationContextInitializerTests {
-
- private final DelegatingApplicationContextInitializer initializer = new DelegatingApplicationContextInitializer();
-
- @Test
- void orderedInitialize() {
- StaticApplicationContext context = new StaticApplicationContext();
- TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context,
- "context.initializer.classes=" + MockInitB.class.getName() + "," + MockInitA.class.getName());
- this.initializer.initialize(context);
- assertThat(context.getBeanFactory().getSingleton("a")).isEqualTo("a");
- assertThat(context.getBeanFactory().getSingleton("b")).isEqualTo("b");
- }
-
- @Test
- void noInitializers() {
- StaticApplicationContext context = new StaticApplicationContext();
- this.initializer.initialize(context);
- }
-
- @Test
- void emptyInitializers() {
- StaticApplicationContext context = new StaticApplicationContext();
- TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context, "context.initializer.classes:");
- this.initializer.initialize(context);
- }
-
- @Test
- void noSuchInitializerClass() {
- StaticApplicationContext context = new StaticApplicationContext();
- TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context,
- "context.initializer.classes=missing.madeup.class");
- assertThatExceptionOfType(ApplicationContextException.class)
- .isThrownBy(() -> this.initializer.initialize(context));
- }
-
- @Test
- void notAnInitializerClass() {
- StaticApplicationContext context = new StaticApplicationContext();
- TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context,
- "context.initializer.classes=" + Object.class.getName());
- assertThatIllegalArgumentException().isThrownBy(() -> this.initializer.initialize(context));
- }
-
- @Test
- void genericNotSuitable() {
- StaticApplicationContext context = new StaticApplicationContext();
- TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context,
- "context.initializer.classes=" + NotSuitableInit.class.getName());
- assertThatIllegalArgumentException().isThrownBy(() -> this.initializer.initialize(context))
- .withMessageContaining("generic parameter");
- }
-
- @Order(Ordered.HIGHEST_PRECEDENCE)
- static class MockInitA implements ApplicationContextInitializer {
-
- @Override
- public void initialize(ConfigurableApplicationContext applicationContext) {
- applicationContext.getBeanFactory().registerSingleton("a", "a");
- }
-
- }
-
- @Order(Ordered.LOWEST_PRECEDENCE)
- static class MockInitB implements ApplicationContextInitializer {
-
- @Override
- public void initialize(ConfigurableApplicationContext applicationContext) {
- assertThat(applicationContext.getBeanFactory().getSingleton("a")).isEqualTo("a");
- applicationContext.getBeanFactory().registerSingleton("b", "b");
- }
-
- }
-
- static class NotSuitableInit implements ApplicationContextInitializer {
-
- @Override
- public void initialize(ConfigurableWebApplicationContext applicationContext) {
- }
-
- }
-
-}
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java
deleted file mode 100644
index c56460014a8..00000000000
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2012-2023 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.context.config;
-
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-import org.springframework.boot.DefaultBootstrapContext;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
-import org.springframework.context.ApplicationListener;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.event.ContextRefreshedEvent;
-import org.springframework.context.support.StaticApplicationContext;
-import org.springframework.core.Ordered;
-import org.springframework.core.annotation.Order;
-import org.springframework.test.context.support.TestPropertySourceUtils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Tests for {@link DelegatingApplicationListener}.
- *
- * @author Dave Syer
- */
-@Deprecated(since = "3.2.0", forRemoval = true)
-@SuppressWarnings("removal")
-class DelegatingApplicationListenerTests {
-
- private final DelegatingApplicationListener listener = new DelegatingApplicationListener();
-
- private final StaticApplicationContext context = new StaticApplicationContext();
-
- @AfterEach
- void close() {
- if (this.context != null) {
- this.context.close();
- }
- }
-
- @Test
- void orderedInitialize() {
- TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context,
- "context.listener.classes=" + MockInitB.class.getName() + "," + MockInitA.class.getName());
- this.listener.onApplicationEvent(new ApplicationEnvironmentPreparedEvent(new DefaultBootstrapContext(),
- new SpringApplication(), new String[0], this.context.getEnvironment()));
- this.context.getBeanFactory().registerSingleton("testListener", this.listener);
- this.context.refresh();
- assertThat(this.context.getBeanFactory().getSingleton("a")).isEqualTo("a");
- assertThat(this.context.getBeanFactory().getSingleton("b")).isEqualTo("b");
- }
-
- @Test
- void noInitializers() {
- this.listener.onApplicationEvent(new ApplicationEnvironmentPreparedEvent(new DefaultBootstrapContext(),
- new SpringApplication(), new String[0], this.context.getEnvironment()));
- }
-
- @Test
- void emptyInitializers() {
- TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "context.listener.classes:");
- this.listener.onApplicationEvent(new ApplicationEnvironmentPreparedEvent(new DefaultBootstrapContext(),
- new SpringApplication(), new String[0], this.context.getEnvironment()));
- }
-
- @Order(Ordered.HIGHEST_PRECEDENCE)
- static class MockInitA implements ApplicationListener {
-
- @Override
- public void onApplicationEvent(ContextRefreshedEvent event) {
- ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) event
- .getApplicationContext();
- applicationContext.getBeanFactory().registerSingleton("a", "a");
- }
-
- }
-
- @Order(Ordered.LOWEST_PRECEDENCE)
- static class MockInitB implements ApplicationListener {
-
- @Override
- public void onApplicationEvent(ContextRefreshedEvent event) {
- ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) event
- .getApplicationContext();
- assertThat(applicationContext.getBeanFactory().getSingleton("a")).isEqualTo("a");
- applicationContext.getBeanFactory().registerSingleton("b", "b");
- }
-
- }
-
-}
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
index fbd182b3524..d9ebfafd44a 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
@@ -17,8 +17,6 @@
package org.springframework.boot.logging.logback;
import java.io.File;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
@@ -30,6 +28,7 @@ import java.util.Map;
import java.util.Set;
import java.util.logging.Handler;
import java.util.logging.LogManager;
+import java.util.stream.Stream;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
@@ -69,7 +68,6 @@ import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MapPropertySource;
import org.springframework.mock.env.MockEnvironment;
import org.springframework.test.util.ReflectionTestUtils;
-import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;
import static org.assertj.core.api.Assertions.assertThat;
@@ -550,20 +548,20 @@ class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
Map properties = loggerContext.getCopyOfPropertyMap();
Set expectedProperties = new HashSet<>();
- ReflectionUtils.doWithFields(LogbackLoggingSystemProperties.class,
- (field) -> expectedProperties.add((String) field.get(null)), this::isPublicStaticFinal);
- expectedProperties.removeAll(Arrays.asList("LOG_FILE", "LOG_PATH"));
+ Stream.of(RollingPolicySystemProperty.values())
+ .map(RollingPolicySystemProperty::getEnvironmentVariableName)
+ .forEach(expectedProperties::add);
+ Stream.of(LoggingSystemProperty.values())
+ .map(LoggingSystemProperty::getEnvironmentVariableName)
+ .forEach(expectedProperties::add);
+ expectedProperties
+ .removeAll(Arrays.asList("LOG_FILE", "LOG_PATH", "LOGGED_APPLICATION_NAME", "LOGGED_APPLICATION_GROUP"));
expectedProperties.add("org.jboss.logging.provider");
expectedProperties.add("LOG_CORRELATION_PATTERN");
assertThat(properties).containsOnlyKeys(expectedProperties);
assertThat(properties).containsEntry("CONSOLE_LOG_CHARSET", Charset.defaultCharset().name());
}
- private boolean isPublicStaticFinal(Field field) {
- int modifiers = field.getModifiers();
- return Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers);
- }
-
@Test
void initializationIsOnlyPerformedOnceUntilCleanedUp() {
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemSslStoreBundleTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemSslStoreBundleTests.java
index b3490193106..9cd7a266d44 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemSslStoreBundleTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemSslStoreBundleTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2024 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.
@@ -167,18 +167,6 @@ class PemSslStoreBundleTests {
assertThat(bundle.getTrustStore()).satisfies(storeContainingCertAndKey("ssl"));
}
- @Test
- @SuppressWarnings("removal")
- void createWithDetailsWhenHasKeyStoreDetailsAndTrustStoreDetailsAndAlias() {
- PemSslStoreDetails keyStoreDetails = PemSslStoreDetails.forCertificate("classpath:test-cert.pem")
- .withPrivateKey("classpath:test-key.pem");
- PemSslStoreDetails trustStoreDetails = PemSslStoreDetails.forCertificate("classpath:test-cert.pem")
- .withPrivateKey("classpath:test-key.pem");
- PemSslStoreBundle bundle = new PemSslStoreBundle(keyStoreDetails, trustStoreDetails, "test-alias");
- assertThat(bundle.getKeyStore()).satisfies(storeContainingCertAndKey("test-alias"));
- assertThat(bundle.getTrustStore()).satisfies(storeContainingCertAndKey("test-alias"));
- }
-
@Test
void createWithDetailsWhenHasStoreType() {
PemSslStoreDetails keyStoreDetails = new PemSslStoreDetails("PKCS12", "classpath:test-cert.pem",
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskExecutorBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskExecutorBuilderTests.java
deleted file mode 100644
index 7df760b63f8..00000000000
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskExecutorBuilderTests.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright 2012-2023 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.task;
-
-import java.time.Duration;
-import java.util.Collections;
-import java.util.Set;
-
-import org.junit.jupiter.api.Test;
-
-import org.springframework.core.task.TaskDecorator;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
-import static org.mockito.BDDMockito.then;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-
-/**
- * Tests for {@link TaskExecutorBuilder}.
- *
- * @author Stephane Nicoll
- * @author Filip Hrisafov
- */
-@SuppressWarnings("removal")
-class TaskExecutorBuilderTests {
-
- private final TaskExecutorBuilder builder = new TaskExecutorBuilder();
-
- @Test
- void poolSettingsShouldApply() {
- ThreadPoolTaskExecutor executor = this.builder.queueCapacity(10)
- .corePoolSize(4)
- .maxPoolSize(8)
- .allowCoreThreadTimeOut(true)
- .keepAlive(Duration.ofMinutes(1))
- .build();
- assertThat(executor).hasFieldOrPropertyWithValue("queueCapacity", 10);
- assertThat(executor.getCorePoolSize()).isEqualTo(4);
- assertThat(executor.getMaxPoolSize()).isEqualTo(8);
- assertThat(executor).hasFieldOrPropertyWithValue("allowCoreThreadTimeOut", true);
- assertThat(executor.getKeepAliveSeconds()).isEqualTo(60);
- }
-
- @Test
- void awaitTerminationShouldApply() {
- ThreadPoolTaskExecutor executor = this.builder.awaitTermination(true).build();
- assertThat(executor).hasFieldOrPropertyWithValue("waitForTasksToCompleteOnShutdown", true);
- }
-
- @Test
- void awaitTerminationPeriodShouldApplyWithMillisecondPrecision() {
- Duration period = Duration.ofMillis(50);
- ThreadPoolTaskExecutor executor = this.builder.awaitTerminationPeriod(period).build();
- assertThat(executor).hasFieldOrPropertyWithValue("awaitTerminationMillis", period.toMillis());
- }
-
- @Test
- void threadNamePrefixShouldApply() {
- ThreadPoolTaskExecutor executor = this.builder.threadNamePrefix("test-").build();
- assertThat(executor.getThreadNamePrefix()).isEqualTo("test-");
- }
-
- @Test
- void taskDecoratorShouldApply() {
- TaskDecorator taskDecorator = mock(TaskDecorator.class);
- ThreadPoolTaskExecutor executor = this.builder.taskDecorator(taskDecorator).build();
- assertThat(executor).extracting("taskDecorator").isSameAs(taskDecorator);
- }
-
- @Test
- void customizersWhenCustomizersAreNullShouldThrowException() {
- assertThatIllegalArgumentException().isThrownBy(() -> this.builder.customizers((TaskExecutorCustomizer[]) null))
- .withMessageContaining("Customizers must not be null");
- }
-
- @Test
- void customizersCollectionWhenCustomizersAreNullShouldThrowException() {
- assertThatIllegalArgumentException()
- .isThrownBy(() -> this.builder.customizers((Set) null))
- .withMessageContaining("Customizers must not be null");
- }
-
- @Test
- void customizersShouldApply() {
- TaskExecutorCustomizer customizer = mock(TaskExecutorCustomizer.class);
- ThreadPoolTaskExecutor executor = this.builder.customizers(customizer).build();
- then(customizer).should().customize(executor);
- }
-
- @Test
- void customizersShouldBeAppliedLast() {
- TaskDecorator taskDecorator = mock(TaskDecorator.class);
- ThreadPoolTaskExecutor executor = spy(new ThreadPoolTaskExecutor());
- this.builder.queueCapacity(10)
- .corePoolSize(4)
- .maxPoolSize(8)
- .allowCoreThreadTimeOut(true)
- .keepAlive(Duration.ofMinutes(1))
- .awaitTermination(true)
- .awaitTerminationPeriod(Duration.ofSeconds(30))
- .threadNamePrefix("test-")
- .taskDecorator(taskDecorator)
- .additionalCustomizers((taskExecutor) -> {
- then(taskExecutor).should().setQueueCapacity(10);
- then(taskExecutor).should().setCorePoolSize(4);
- then(taskExecutor).should().setMaxPoolSize(8);
- then(taskExecutor).should().setAllowCoreThreadTimeOut(true);
- then(taskExecutor).should().setKeepAliveSeconds(60);
- then(taskExecutor).should().setWaitForTasksToCompleteOnShutdown(true);
- then(taskExecutor).should().setAwaitTerminationSeconds(30);
- then(taskExecutor).should().setThreadNamePrefix("test-");
- then(taskExecutor).should().setTaskDecorator(taskDecorator);
- });
- this.builder.configure(executor);
- }
-
- @Test
- void customizersShouldReplaceExisting() {
- TaskExecutorCustomizer customizer1 = mock(TaskExecutorCustomizer.class);
- TaskExecutorCustomizer customizer2 = mock(TaskExecutorCustomizer.class);
- ThreadPoolTaskExecutor executor = this.builder.customizers(customizer1)
- .customizers(Collections.singleton(customizer2))
- .build();
- then(customizer1).shouldHaveNoInteractions();
- then(customizer2).should().customize(executor);
- }
-
- @Test
- void additionalCustomizersWhenCustomizersAreNullShouldThrowException() {
- assertThatIllegalArgumentException()
- .isThrownBy(() -> this.builder.additionalCustomizers((TaskExecutorCustomizer[]) null))
- .withMessageContaining("Customizers must not be null");
- }
-
- @Test
- void additionalCustomizersCollectionWhenCustomizersAreNullShouldThrowException() {
- assertThatIllegalArgumentException()
- .isThrownBy(() -> this.builder.additionalCustomizers((Set) null))
- .withMessageContaining("Customizers must not be null");
- }
-
- @Test
- void additionalCustomizersShouldAddToExisting() {
- TaskExecutorCustomizer customizer1 = mock(TaskExecutorCustomizer.class);
- TaskExecutorCustomizer customizer2 = mock(TaskExecutorCustomizer.class);
- ThreadPoolTaskExecutor executor = this.builder.customizers(customizer1)
- .additionalCustomizers(customizer2)
- .build();
- then(customizer1).should().customize(executor);
- then(customizer2).should().customize(executor);
- }
-
-}
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskSchedulerBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskSchedulerBuilderTests.java
deleted file mode 100644
index 095e8fda4ed..00000000000
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskSchedulerBuilderTests.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 2012-2023 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.task;
-
-import java.time.Duration;
-import java.util.Collections;
-import java.util.Set;
-
-import org.junit.jupiter.api.Test;
-
-import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
-import static org.mockito.BDDMockito.then;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-
-/**
- * Tests for {@link TaskSchedulerBuilder}.
- *
- * @author Stephane Nicoll
- */
-@SuppressWarnings("removal")
-class TaskSchedulerBuilderTests {
-
- private final TaskSchedulerBuilder builder = new TaskSchedulerBuilder();
-
- @Test
- void poolSettingsShouldApply() {
- ThreadPoolTaskScheduler scheduler = this.builder.poolSize(4).build();
- assertThat(scheduler.getPoolSize()).isEqualTo(4);
- }
-
- @Test
- void awaitTerminationShouldApply() {
- ThreadPoolTaskScheduler executor = this.builder.awaitTermination(true).build();
- assertThat(executor).hasFieldOrPropertyWithValue("waitForTasksToCompleteOnShutdown", true);
- }
-
- @Test
- void awaitTerminationPeriodShouldApply() {
- Duration period = Duration.ofMinutes(1);
- ThreadPoolTaskScheduler executor = this.builder.awaitTerminationPeriod(period).build();
- assertThat(executor).hasFieldOrPropertyWithValue("awaitTerminationMillis", period.toMillis());
- }
-
- @Test
- void threadNamePrefixShouldApply() {
- ThreadPoolTaskScheduler scheduler = this.builder.threadNamePrefix("test-").build();
- assertThat(scheduler.getThreadNamePrefix()).isEqualTo("test-");
- }
-
- @Test
- void customizersWhenCustomizersAreNullShouldThrowException() {
- assertThatIllegalArgumentException()
- .isThrownBy(() -> this.builder.customizers((TaskSchedulerCustomizer[]) null))
- .withMessageContaining("Customizers must not be null");
- }
-
- @Test
- void customizersCollectionWhenCustomizersAreNullShouldThrowException() {
- assertThatIllegalArgumentException()
- .isThrownBy(() -> this.builder.customizers((Set) null))
- .withMessageContaining("Customizers must not be null");
- }
-
- @Test
- void customizersShouldApply() {
- TaskSchedulerCustomizer customizer = mock(TaskSchedulerCustomizer.class);
- ThreadPoolTaskScheduler scheduler = this.builder.customizers(customizer).build();
- then(customizer).should().customize(scheduler);
- }
-
- @Test
- void customizersShouldBeAppliedLast() {
- ThreadPoolTaskScheduler scheduler = spy(new ThreadPoolTaskScheduler());
- this.builder.poolSize(4).threadNamePrefix("test-").additionalCustomizers((taskScheduler) -> {
- then(taskScheduler).should().setPoolSize(4);
- then(taskScheduler).should().setThreadNamePrefix("test-");
- });
- this.builder.configure(scheduler);
- }
-
- @Test
- void customizersShouldReplaceExisting() {
- TaskSchedulerCustomizer customizer1 = mock(TaskSchedulerCustomizer.class);
- TaskSchedulerCustomizer customizer2 = mock(TaskSchedulerCustomizer.class);
- ThreadPoolTaskScheduler scheduler = this.builder.customizers(customizer1)
- .customizers(Collections.singleton(customizer2))
- .build();
- then(customizer1).shouldHaveNoInteractions();
- then(customizer2).should().customize(scheduler);
- }
-
- @Test
- void additionalCustomizersWhenCustomizersAreNullShouldThrowException() {
- assertThatIllegalArgumentException()
- .isThrownBy(() -> this.builder.additionalCustomizers((TaskSchedulerCustomizer[]) null))
- .withMessageContaining("Customizers must not be null");
- }
-
- @Test
- void additionalCustomizersCollectionWhenCustomizersAreNullShouldThrowException() {
- assertThatIllegalArgumentException()
- .isThrownBy(() -> this.builder.additionalCustomizers((Set) null))
- .withMessageContaining("Customizers must not be null");
- }
-
- @Test
- void additionalCustomizersShouldAddToExisting() {
- TaskSchedulerCustomizer customizer1 = mock(TaskSchedulerCustomizer.class);
- TaskSchedulerCustomizer customizer2 = mock(TaskSchedulerCustomizer.class);
- ThreadPoolTaskScheduler scheduler = this.builder.customizers(customizer1)
- .additionalCustomizers(customizer2)
- .build();
- then(customizer1).should().customize(scheduler);
- then(customizer2).should().customize(scheduler);
- }
-
-}
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriBuilderFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriBuilderFactoryTests.java
index 1a77773cd74..a3dd338a2d1 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriBuilderFactoryTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriBuilderFactoryTests.java
@@ -23,8 +23,10 @@ import org.junit.jupiter.api.Test;
import org.springframework.web.util.UriBuilder;
import org.springframework.web.util.UriBuilderFactory;
+import org.springframework.web.util.UriTemplateHandler;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
/**
* Tests for {@link RootUriBuilderFactory}.
@@ -35,7 +37,8 @@ class RootUriBuilderFactoryTests {
@Test
void uriStringPrefixesRoot() throws URISyntaxException {
- UriBuilderFactory builderFactory = new RootUriBuilderFactory("https://example.com");
+ UriBuilderFactory builderFactory = new RootUriBuilderFactory("https://example.com",
+ mock(UriTemplateHandler.class));
UriBuilder builder = builderFactory.uriString("/hello");
assertThat(builder.build()).isEqualTo(new URI("https://example.com/hello"));
}
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java
index 56288dc3d71..af04e9da089 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java
@@ -27,7 +27,6 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
-import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriTemplateHandler;
import static org.assertj.core.api.Assertions.assertThat;
@@ -36,6 +35,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.then;
+import static org.mockito.Mockito.mock;
/**
* Tests for {@link RootUriTemplateHandler}.
@@ -43,7 +43,6 @@ import static org.mockito.BDDMockito.then;
* @author Phillip Webb
*/
@ExtendWith(MockitoExtension.class)
-@SuppressWarnings("removal")
class RootUriTemplateHandlerTests {
private URI uri;
@@ -61,7 +60,8 @@ class RootUriTemplateHandlerTests {
@Test
void createWithNullRootUriShouldThrowException() {
- assertThatIllegalArgumentException().isThrownBy(() -> new RootUriTemplateHandler((String) null))
+ assertThatIllegalArgumentException()
+ .isThrownBy(() -> new RootUriTemplateHandler((String) null, mock(UriTemplateHandler.class)))
.withMessageContaining("RootUri must not be null");
}
@@ -109,16 +109,4 @@ class RootUriTemplateHandlerTests {
assertThat(expanded).isEqualTo(this.uri);
}
- @Test
- void applyShouldWrapExistingTemplate() {
- given(this.delegate.expand(anyString(), any(Object[].class))).willReturn(this.uri);
- RestTemplate restTemplate = new RestTemplate();
- restTemplate.setUriTemplateHandler(this.delegate);
- this.handler = RootUriTemplateHandler.addTo(restTemplate, "https://example.com");
- Object[] uriVariables = new Object[0];
- URI expanded = this.handler.expand("/hello", uriVariables);
- then(this.delegate).should().expand("https://example.com/hello", uriVariables);
- assertThat(expanded).isEqualTo(this.uri);
- }
-
}