Remove APIs that were deprecated for removal in 3.4.0
Closes gh-41435
This commit is contained in:
@@ -113,7 +113,7 @@ public class Neo4jDataAutoConfiguration {
|
||||
public Neo4jTransactionManager transactionManager(Driver driver, DatabaseSelectionProvider databaseNameProvider,
|
||||
ObjectProvider<TransactionManagerCustomizers> optionalCustomizers) {
|
||||
Neo4jTransactionManager transactionManager = new Neo4jTransactionManager(driver, databaseNameProvider);
|
||||
optionalCustomizers.ifAvailable((customizer) -> customizer.customize((TransactionManager) transactionManager));
|
||||
optionalCustomizers.ifAvailable((customizer) -> customizer.customize(transactionManager));
|
||||
return transactionManager;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,71 +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 okhttp3.OkHttpClient;
|
||||
import org.influxdb.InfluxDB;
|
||||
import org.influxdb.impl.InfluxDBImpl;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for InfluxDB.
|
||||
*
|
||||
* @author Sergey Kuptsov
|
||||
* @author Stephane Nicoll
|
||||
* @author Eddú Meléndez
|
||||
* @author Moritz Halbritter
|
||||
* @author Andy Wilkinson
|
||||
* @author Phillip Webb
|
||||
* @since 2.0.0
|
||||
* @deprecated since 3.2.0 for removal in 3.4.0 in favor of the
|
||||
* <a href="https://github.com/influxdata/influxdb-client-java">new client</a> and its own
|
||||
* Spring Boot integration.
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnClass(InfluxDB.class)
|
||||
@EnableConfigurationProperties(InfluxDbProperties.class)
|
||||
@ConditionalOnProperty("spring.influx.url")
|
||||
@Deprecated(since = "3.2.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class InfluxDbAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public InfluxDB influxDb(InfluxDbProperties properties, ObjectProvider<InfluxDbOkHttpClientBuilderProvider> builder,
|
||||
ObjectProvider<InfluxDbCustomizer> customizers) {
|
||||
InfluxDB influxDb = new InfluxDBImpl(properties.getUrl().toString(), properties.getUser(),
|
||||
properties.getPassword(), determineBuilder(builder.getIfAvailable()));
|
||||
customizers.orderedStream().forEach((customizer) -> customizer.customize(influxDb));
|
||||
return influxDb;
|
||||
}
|
||||
|
||||
private static OkHttpClient.Builder determineBuilder(InfluxDbOkHttpClientBuilderProvider builder) {
|
||||
if (builder != null) {
|
||||
return builder.get();
|
||||
}
|
||||
return new OkHttpClient.Builder();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +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 org.influxdb.InfluxDB;
|
||||
|
||||
/**
|
||||
* Callback interface that can be implemented by beans wishing to further customize
|
||||
* {@code InfluxDB} whilst retaining default auto-configuration.
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
* @since 2.5.0
|
||||
* @deprecated since 3.2.0 for removal in 3.4.0 in favor of the
|
||||
* <a href="https://github.com/influxdata/influxdb-client-java">new client</a> and its own
|
||||
* Spring Boot integration.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@Deprecated(since = "3.2.0", forRemoval = true)
|
||||
public interface InfluxDbCustomizer {
|
||||
|
||||
/**
|
||||
* Customize the {@link InfluxDB}.
|
||||
* @param influxDb the InfluxDB instance to customize
|
||||
*/
|
||||
void customize(InfluxDB influxDb);
|
||||
|
||||
}
|
||||
@@ -1,38 +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.function.Supplier;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import org.influxdb.InfluxDB;
|
||||
|
||||
/**
|
||||
* Provide the {@link okhttp3.OkHttpClient.Builder OkHttpClient.Builder} to use to
|
||||
* customize the auto-configured {@link InfluxDB} instance.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 2.1.0
|
||||
* @deprecated since 3.2.0 for removal in 3.4.0 in favor of the
|
||||
* <a href="https://github.com/influxdata/influxdb-client-java">new client</a> and its own
|
||||
* Spring Boot integration.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@Deprecated(since = "3.2.0", forRemoval = true)
|
||||
public interface InfluxDbOkHttpClientBuilderProvider extends Supplier<OkHttpClient.Builder> {
|
||||
|
||||
}
|
||||
@@ -1,81 +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 org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
|
||||
|
||||
/**
|
||||
* Configuration properties for InfluxDB.
|
||||
*
|
||||
* @author Sergey Kuptsov
|
||||
* @author Stephane Nicoll
|
||||
* @since 2.0.0
|
||||
* @deprecated since 3.2.0 for removal in 3.4.0 in favor of the
|
||||
* <a href="https://github.com/influxdata/influxdb-client-java">new InfluxDB Java
|
||||
* client</a> and its own Spring Boot integration.
|
||||
*/
|
||||
@Deprecated(since = "3.2.0", forRemoval = true)
|
||||
@ConfigurationProperties(prefix = "spring.influx")
|
||||
public class InfluxDbProperties {
|
||||
|
||||
/**
|
||||
* URL of the InfluxDB instance to which to connect.
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* Login user.
|
||||
*/
|
||||
private String user;
|
||||
|
||||
/**
|
||||
* Login password.
|
||||
*/
|
||||
private String password;
|
||||
|
||||
@DeprecatedConfigurationProperty(reason = "the new InfluxDb Java client provides Spring Boot integration",
|
||||
since = "3.2.0")
|
||||
public String getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@DeprecatedConfigurationProperty(reason = "the new InfluxDb Java client provides Spring Boot integration",
|
||||
since = "3.2.0")
|
||||
public String getUser() {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@DeprecatedConfigurationProperty(reason = "the new InfluxDb Java client provides Spring Boot integration",
|
||||
since = "3.2.0")
|
||||
public String getPassword() {
|
||||
return this.password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Auto-configuration for InfluxDB.
|
||||
*/
|
||||
package org.springframework.boot.autoconfigure.influx;
|
||||
@@ -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.
|
||||
@@ -24,7 +24,6 @@ import javax.sql.DataSource;
|
||||
import io.rsocket.transport.netty.server.TcpServerTransport;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.AnyNestedCondition;
|
||||
@@ -43,7 +42,6 @@ import org.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfigurati
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.PropertyMapper;
|
||||
import org.springframework.boot.context.properties.source.MutuallyExclusiveConfigurationPropertiesException;
|
||||
import org.springframework.boot.task.TaskSchedulerBuilder;
|
||||
import org.springframework.boot.task.ThreadPoolTaskSchedulerBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
@@ -168,20 +166,13 @@ public class IntegrationAutoConfiguration {
|
||||
* scheduling explicitly.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnBean(TaskSchedulerBuilder.class)
|
||||
@ConditionalOnBean(ThreadPoolTaskSchedulerBuilder.class)
|
||||
@ConditionalOnMissingBean(name = IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME)
|
||||
@SuppressWarnings("removal")
|
||||
protected static class IntegrationTaskSchedulerConfiguration {
|
||||
|
||||
@Bean(name = IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME)
|
||||
public ThreadPoolTaskScheduler taskScheduler(TaskSchedulerBuilder taskSchedulerBuilder,
|
||||
ObjectProvider<ThreadPoolTaskSchedulerBuilder> threadPoolTaskSchedulerBuilderProvider) {
|
||||
ThreadPoolTaskSchedulerBuilder threadPoolTaskSchedulerBuilder = threadPoolTaskSchedulerBuilderProvider
|
||||
.getIfUnique();
|
||||
if (threadPoolTaskSchedulerBuilder != null) {
|
||||
return threadPoolTaskSchedulerBuilder.build();
|
||||
}
|
||||
return taskSchedulerBuilder.build();
|
||||
public ThreadPoolTaskScheduler taskScheduler(ThreadPoolTaskSchedulerBuilder threadPoolTaskSchedulerBuilder) {
|
||||
return threadPoolTaskSchedulerBuilder.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -63,8 +63,7 @@ public class DataSourceTransactionManagerAutoConfiguration {
|
||||
DataSourceTransactionManager transactionManager(Environment environment, DataSource dataSource,
|
||||
ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers) {
|
||||
DataSourceTransactionManager transactionManager = createTransactionManager(environment, dataSource);
|
||||
transactionManagerCustomizers
|
||||
.ifAvailable((customizers) -> customizers.customize((TransactionManager) transactionManager));
|
||||
transactionManagerCustomizers.ifAvailable((customizers) -> customizers.customize(transactionManager));
|
||||
return transactionManager;
|
||||
}
|
||||
|
||||
|
||||
@@ -176,21 +176,6 @@ public class KafkaProperties {
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an initial map of consumer properties from the state of this instance.
|
||||
* <p>
|
||||
* This allows you to add additional properties, if necessary, and override the
|
||||
* default {@code kafkaConsumerFactory} bean.
|
||||
* @return the consumer properties initialized with the customizations defined on this
|
||||
* instance
|
||||
* @deprecated since 3.2.0 for removal in 3.4.0 in favor of
|
||||
* {@link #buildConsumerProperties(SslBundles)}}
|
||||
*/
|
||||
@Deprecated(since = "3.2.0", forRemoval = true)
|
||||
public Map<String, Object> buildConsumerProperties() {
|
||||
return buildConsumerProperties(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an initial map of consumer properties from the state of this instance.
|
||||
* <p>
|
||||
@@ -206,21 +191,6 @@ public class KafkaProperties {
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an initial map of producer properties from the state of this instance.
|
||||
* <p>
|
||||
* 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<String, Object> buildProducerProperties() {
|
||||
return buildProducerProperties(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an initial map of producer properties from the state of this instance.
|
||||
* <p>
|
||||
@@ -236,21 +206,6 @@ public class KafkaProperties {
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an initial map of admin properties from the state of this instance.
|
||||
* <p>
|
||||
* 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<String, Object> buildAdminProperties() {
|
||||
return buildAdminProperties(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an initial map of admin properties from the state of this instance.
|
||||
* <p>
|
||||
@@ -266,20 +221,6 @@ public class KafkaProperties {
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an initial map of streams properties from the state of this instance.
|
||||
* <p>
|
||||
* 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<String, Object> buildStreamsProperties() {
|
||||
return buildStreamsProperties(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an initial map of streams properties from the state of this instance.
|
||||
* <p>
|
||||
|
||||
@@ -95,8 +95,7 @@ public abstract class JpaBaseConfiguration {
|
||||
public PlatformTransactionManager transactionManager(
|
||||
ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers) {
|
||||
JpaTransactionManager transactionManager = new JpaTransactionManager();
|
||||
transactionManagerCustomizers
|
||||
.ifAvailable((customizers) -> customizers.customize((TransactionManager) transactionManager));
|
||||
transactionManagerCustomizers.ifAvailable((customizers) -> customizers.customize(transactionManager));
|
||||
return transactionManager;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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<ThreadPoolTaskExecutorBuilder> threadPoolTaskExecutorBuilderProvider) {
|
||||
ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder = threadPoolTaskExecutorBuilderProvider
|
||||
.getIfUnique();
|
||||
if (threadPoolTaskExecutorBuilder != null) {
|
||||
return threadPoolTaskExecutorBuilder.build();
|
||||
}
|
||||
return taskExecutorBuilder.build();
|
||||
ThreadPoolTaskExecutor applicationTaskExecutor(ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder) {
|
||||
return threadPoolTaskExecutorBuilder.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@SuppressWarnings("removal")
|
||||
static class TaskExecutorBuilderConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@Deprecated(since = "3.2.0", forRemoval = true)
|
||||
TaskExecutorBuilder taskExecutorBuilder(TaskExecutionProperties properties,
|
||||
ObjectProvider<TaskExecutorCustomizer> taskExecutorCustomizers,
|
||||
ObjectProvider<TaskDecorator> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@SuppressWarnings("removal")
|
||||
static class ThreadPoolTaskExecutorBuilderConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean({ TaskExecutorBuilder.class, ThreadPoolTaskExecutorBuilder.class })
|
||||
@ConditionalOnMissingBean(ThreadPoolTaskExecutorBuilder.class)
|
||||
ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder(TaskExecutionProperties properties,
|
||||
ObjectProvider<ThreadPoolTaskExecutorCustomizer> threadPoolTaskExecutorCustomizers,
|
||||
ObjectProvider<TaskExecutorCustomizer> taskExecutorCustomizers,
|
||||
ObjectProvider<TaskDecorator> 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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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<ThreadPoolTaskSchedulerBuilder> 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<TaskSchedulerCustomizer> 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<ThreadPoolTaskSchedulerCustomizer> threadPoolTaskSchedulerCustomizers,
|
||||
ObjectProvider<TaskSchedulerCustomizer> taskSchedulerCustomizers) {
|
||||
ObjectProvider<ThreadPoolTaskSchedulerCustomizer> 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)
|
||||
|
||||
@@ -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 <T> 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<T extends PlatformTransactionManager>
|
||||
extends TransactionManagerCustomizer<T> {
|
||||
|
||||
}
|
||||
@@ -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.<TransactionManagerCustomizer<?>>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
|
||||
|
||||
@@ -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> transactionManagerCustomizers) {
|
||||
JtaTransactionManager jtaTransactionManager = new JtaTransactionManager();
|
||||
transactionManagerCustomizers
|
||||
.ifAvailable((customizers) -> customizers.customize((TransactionManager) jtaTransactionManager));
|
||||
transactionManagerCustomizers.ifAvailable((customizers) -> customizers.customize(jtaTransactionManager));
|
||||
return jtaTransactionManager;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<AssertableApplicationContext> assertTaskExecutor(
|
||||
Consumer<ThreadPoolTaskExecutor> taskExecutor) {
|
||||
return (context) -> {
|
||||
assertThat(context).hasSingleBean(TaskExecutorBuilder.class);
|
||||
TaskExecutorBuilder builder = context.getBean(TaskExecutorBuilder.class);
|
||||
taskExecutor.accept(builder.build());
|
||||
};
|
||||
}
|
||||
|
||||
private ContextConsumer<AssertableApplicationContext> assertThreadPoolTaskExecutor(
|
||||
Consumer<ThreadPoolTaskExecutor> 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 {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user