From a18f01addfb546cf5bb984f4dc739f688348535e Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 15 Jan 2021 14:05:01 +0100 Subject: [PATCH 1/2] Remove bitronix support See gh-24806 --- .../spring-boot-autoconfigure/build.gradle | 1 - .../jta/BitronixJtaConfiguration.java | 121 ---------- .../transaction/jta/JtaAutoConfiguration.java | 3 +- ...itional-spring-configuration-metadata.json | 113 --------- .../jta/JtaAutoConfigurationTests.java | 78 ------ .../spring-boot-dependencies/build.gradle | 8 - .../docs/asciidoc/spring-boot-features.adoc | 19 -- .../build.gradle | 14 -- spring-boot-project/spring-boot/build.gradle | 1 - ...onixDependentBeanFactoryPostProcessor.java | 81 ------- .../BitronixXAConnectionFactoryWrapper.java | 42 ---- .../bitronix/BitronixXADataSourceWrapper.java | 41 ---- .../PoolingConnectionFactoryBean.java | 157 ------------ .../jta/bitronix/PoolingDataSourceBean.java | 179 -------------- .../boot/jta/bitronix/package-info.java | 21 -- ...itional-spring-configuration-metadata.json | 224 +++++++++++------- ...ependentBeanFactoryPostProcessorTests.java | 81 ------- ...tronixXAConnectionFactoryWrapperTests.java | 44 ---- .../BitronixXADataSourceWrapperTests.java | 44 ---- .../PoolingConnectionFactoryBeanTests.java | 77 ------ .../bitronix/PoolingDataSourceBeanTests.java | 104 -------- .../build.gradle | 23 -- .../main/java/smoketest/bitronix/Account.java | 43 ---- .../smoketest/bitronix/AccountRepository.java | 23 -- .../smoketest/bitronix/AccountService.java | 45 ---- .../java/smoketest/bitronix/Messages.java | 30 --- .../bitronix/SampleBitronixApplication.java | 45 ---- .../src/main/resources/application.properties | 2 - .../SampleBitronixApplicationTests.java | 68 ------ 29 files changed, 142 insertions(+), 1590 deletions(-) delete mode 100644 spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java delete mode 100644 spring-boot-project/spring-boot-starters/spring-boot-starter-jta-bitronix/build.gradle delete mode 100644 spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessor.java delete mode 100644 spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapper.java delete mode 100644 spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapper.java delete mode 100644 spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java delete mode 100644 spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java delete mode 100644 spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/package-info.java delete mode 100644 spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessorTests.java delete mode 100644 spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapperTests.java delete mode 100644 spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapperTests.java delete mode 100644 spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBeanTests.java delete mode 100644 spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBeanTests.java delete mode 100644 spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/build.gradle delete mode 100644 spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/Account.java delete mode 100644 spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/AccountRepository.java delete mode 100644 spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/AccountService.java delete mode 100644 spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/Messages.java delete mode 100644 spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/SampleBitronixApplication.java delete mode 100644 spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/resources/application.properties delete mode 100644 spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/test/java/smoketest/bitronix/SampleBitronixApplicationTests.java diff --git a/spring-boot-project/spring-boot-autoconfigure/build.gradle b/spring-boot-project/spring-boot-autoconfigure/build.gradle index 3fe8e6d23b..b1982f8ec0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/build.gradle +++ b/spring-boot-project/spring-boot-autoconfigure/build.gradle @@ -62,7 +62,6 @@ dependencies { optional("org.apache.tomcat.embed:tomcat-embed-el") optional("org.apache.tomcat.embed:tomcat-embed-websocket") optional("org.apache.tomcat:tomcat-jdbc") - optional("org.codehaus.btm:btm") optional("org.codehaus.groovy:groovy-templates") optional("com.github.ben-manes.caffeine:caffeine") optional("com.github.mxab.thymeleaf.extras:thymeleaf-extras-data-attribute") diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java deleted file mode 100644 index 8ed2489aff..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2012-2020 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.jta; - -import java.io.File; - -import javax.jms.Message; -import javax.transaction.TransactionManager; -import javax.transaction.UserTransaction; - -import bitronix.tm.BitronixTransactionManager; -import bitronix.tm.TransactionManagerServices; -import bitronix.tm.jndi.BitronixContext; - -import org.springframework.beans.factory.ObjectProvider; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.boot.jdbc.XADataSourceWrapper; -import org.springframework.boot.jms.XAConnectionFactoryWrapper; -import org.springframework.boot.system.ApplicationHome; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.transaction.jta.JtaTransactionManager; -import org.springframework.util.StringUtils; - -/** - * JTA Configuration for Bitronix. - * - * @author Josh Long - * @author Phillip Webb - * @author Andy Wilkinson - * @author Kazuki Shimizu - * @deprecated since 2.3.0 as the Bitronix project is no longer being maintained - */ -@Deprecated -@Configuration(proxyBeanMethods = false) -@EnableConfigurationProperties(JtaProperties.class) -@ConditionalOnClass({ JtaTransactionManager.class, BitronixContext.class }) -@ConditionalOnMissingBean(org.springframework.transaction.TransactionManager.class) -class BitronixJtaConfiguration { - - @Bean - @ConditionalOnMissingBean - @ConfigurationProperties(prefix = "spring.jta.bitronix.properties") - bitronix.tm.Configuration bitronixConfiguration(JtaProperties jtaProperties) { - bitronix.tm.Configuration config = TransactionManagerServices.getConfiguration(); - if (StringUtils.hasText(jtaProperties.getTransactionManagerId())) { - config.setServerId(jtaProperties.getTransactionManagerId()); - } - File logBaseDir = getLogBaseDir(jtaProperties); - config.setLogPart1Filename(new File(logBaseDir, "part1.btm").getAbsolutePath()); - config.setLogPart2Filename(new File(logBaseDir, "part2.btm").getAbsolutePath()); - config.setDisableJmx(true); - return config; - } - - private File getLogBaseDir(JtaProperties jtaProperties) { - if (StringUtils.hasLength(jtaProperties.getLogDir())) { - return new File(jtaProperties.getLogDir()); - } - File home = new ApplicationHome().getDir(); - return new File(home, "transaction-logs"); - } - - @Bean - @ConditionalOnMissingBean(TransactionManager.class) - BitronixTransactionManager bitronixTransactionManager(bitronix.tm.Configuration configuration) { - // Inject configuration to force ordering - return TransactionManagerServices.getTransactionManager(); - } - - @Bean - @ConditionalOnMissingBean(XADataSourceWrapper.class) - org.springframework.boot.jta.bitronix.BitronixXADataSourceWrapper xaDataSourceWrapper() { - return new org.springframework.boot.jta.bitronix.BitronixXADataSourceWrapper(); - } - - @Bean - @ConditionalOnMissingBean - static org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor bitronixDependentBeanFactoryPostProcessor() { - return new org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor(); - } - - @Bean - JtaTransactionManager transactionManager(UserTransaction userTransaction, TransactionManager transactionManager, - ObjectProvider transactionManagerCustomizers) { - JtaTransactionManager jtaTransactionManager = new JtaTransactionManager(userTransaction, transactionManager); - transactionManagerCustomizers.ifAvailable((customizers) -> customizers.customize(jtaTransactionManager)); - return jtaTransactionManager; - } - - @Configuration(proxyBeanMethods = false) - @ConditionalOnClass(Message.class) - static class BitronixJtaJmsConfiguration { - - @Bean - @ConditionalOnMissingBean(XAConnectionFactoryWrapper.class) - org.springframework.boot.jta.bitronix.BitronixXAConnectionFactoryWrapper xaConnectionFactoryWrapper() { - return new org.springframework.boot.jta.bitronix.BitronixXAConnectionFactoryWrapper(); - } - - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfiguration.java index 2b8d8cfefb..c93bc02099 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfiguration.java @@ -35,13 +35,12 @@ import org.springframework.context.annotation.Import; * @author Nishant Raut * @since 1.2.0 */ -@SuppressWarnings("deprecation") @Configuration(proxyBeanMethods = false) @ConditionalOnClass(javax.transaction.Transaction.class) @ConditionalOnProperty(prefix = "spring.jta", value = "enabled", matchIfMissing = true) @AutoConfigureBefore({ XADataSourceAutoConfiguration.class, ActiveMQAutoConfiguration.class, ArtemisAutoConfiguration.class, HibernateJpaAutoConfiguration.class }) -@Import({ JndiJtaConfiguration.class, BitronixJtaConfiguration.class, AtomikosJtaConfiguration.class }) +@Import({ JndiJtaConfiguration.class, AtomikosJtaConfiguration.class }) public class JtaAutoConfiguration { } 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 d3ff212ece..81bafc5b64 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 @@ -1041,119 +1041,6 @@ "name": "spring.jpa.open-in-view", "defaultValue": true }, - { - "name": "spring.jta.bitronix.properties.allow-multiple-lrc", - "description": "Whether to allow multiple LRC resources to be enlisted into the same transaction.", - "defaultValue": false - }, - { - "name": "spring.jta.bitronix.properties.asynchronous2-pc", - "description": "Whether to enable asynchronously execution of two phase commit.", - "defaultValue": false - }, - { - "name": "spring.jta.bitronix.properties.background-recovery-interval", - "description": "Interval in minutes at which to run the recovery process in the background.", - "defaultValue": 1, - "deprecation": { - "replacement": "spring.jta.bitronix.properties.background-recovery-interval-seconds" - } - }, - { - "name": "spring.jta.bitronix.properties.background-recovery-interval-seconds", - "description": "Interval in seconds at which to run the recovery process in the background.", - "defaultValue": 60 - }, - { - "name": "spring.jta.bitronix.properties.current-node-only-recovery", - "description": "Whether to recover only the current node. Should be enabled if you run multiple instances of the transaction manager on the same JMS and JDBC resources.", - "defaultValue": true - }, - { - "name": "spring.jta.bitronix.properties.debug-zero-resource-transaction", - "description": "Whether to log the creation and commit call stacks of transactions executed without a single enlisted resource.", - "defaultValue": false - }, - { - "name": "spring.jta.bitronix.properties.default-transaction-timeout", - "description": "Default transaction timeout, in seconds.", - "defaultValue": 60 - }, - { - "name": "spring.jta.bitronix.properties.disable-jmx", - "description": "Whether to enable JMX support.", - "defaultValue": false - }, - { - "name": "spring.jta.bitronix.properties.exception-analyzer", - "description": "Set the fully qualified name of the exception analyzer implementation to use." - }, - { - "name": "spring.jta.bitronix.properties.filter-log-status", - "description": "Whether to enable filtering of logs so that only mandatory logs are written.", - "defaultValue": false - }, - { - "name": "spring.jta.bitronix.properties.force-batching-enabled", - "description": "Whether disk forces are batched.", - "defaultValue": true - }, - { - "name": "spring.jta.bitronix.properties.forced-write-enabled", - "description": "Whether logs are forced to disk.", - "defaultValue": true - }, - { - "name": "spring.jta.bitronix.properties.graceful-shutdown-interval", - "description": "Maximum amount of seconds the TM waits for transactions to get done before aborting them at shutdown time.", - "defaultValue": 60 - }, - { - "name": "spring.jta.bitronix.properties.jndi-transaction-synchronization-registry-name", - "description": "JNDI name of the TransactionSynchronizationRegistry." - }, - { - "name": "spring.jta.bitronix.properties.jndi-user-transaction-name", - "description": "JNDI name of the UserTransaction." - }, - { - "name": "spring.jta.bitronix.properties.journal", - "description": "Name of the journal. Can be 'disk', 'null', or a class name.", - "defaultValue": "disk" - }, - { - "name": "spring.jta.bitronix.properties.log-part1-filename", - "description": "Name of the first fragment of the journal.", - "defaultValue": "btm1.tlog" - }, - { - "name": "spring.jta.bitronix.properties.log-part2-filename", - "description": "Name of the second fragment of the journal.", - "defaultValue": "btm2.tlog" - }, - { - "name": "spring.jta.bitronix.properties.max-log-size-in-mb", - "description": "Maximum size in megabytes of the journal fragments.", - "defaultValue": 2 - }, - { - "name": "spring.jta.bitronix.properties.resource-configuration-filename", - "description": "ResourceLoader configuration file name." - }, - { - "name": "spring.jta.bitronix.properties.server-id", - "description": "ASCII ID that must uniquely identify this TM instance. Defaults to the machine's IP address." - }, - { - "name": "spring.jta.bitronix.properties.skip-corrupted-logs", - "description": "Skip corrupted transactions log entries. Use only at last resort when all you have to recover is a pair of corrupted files.", - "defaultValue": false - }, - { - "name": "spring.jta.bitronix.properties.warn-about-zero-resource-transaction", - "description": "Whether to log a warning for transactions executed without a single enlisted resource.", - "defaultValue": true - }, { "name": "spring.jta.enabled", "type": "java.lang.Boolean", diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java index fd14185299..d9516c9014 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java @@ -18,8 +18,6 @@ package org.springframework.boot.autoconfigure.transaction.jta; import java.io.File; import java.io.IOException; -import java.net.InetAddress; -import java.net.UnknownHostException; import java.nio.file.Path; import javax.jms.ConnectionFactory; @@ -29,7 +27,6 @@ import javax.jms.XAConnectionFactory; import javax.jms.XASession; import javax.sql.DataSource; import javax.sql.XADataSource; -import javax.transaction.TransactionManager; import javax.transaction.UserTransaction; import javax.transaction.xa.XAResource; @@ -67,7 +64,6 @@ import static org.mockito.Mockito.mock; * @author Kazuki Shimizu * @author Nishant Raut */ -// @SuppressWarnings("deprecation") class JtaAutoConfigurationTests { private AnnotationConfigApplicationContext context; @@ -111,37 +107,6 @@ class JtaAutoConfigurationTests { this.context.getBean(JtaTransactionManager.class); } - @Test - @Deprecated - void bitronixSanityCheck() { - this.context = new AnnotationConfigApplicationContext(JtaProperties.class, BitronixJtaConfiguration.class); - this.context.getBean(bitronix.tm.Configuration.class); - this.context.getBean(TransactionManager.class); - this.context.getBean(XADataSourceWrapper.class); - this.context.getBean(XAConnectionFactoryWrapper.class); - this.context.getBean(org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor.class); - this.context.getBean(JtaTransactionManager.class); - } - - @Test - @Deprecated - void defaultBitronixServerId() throws UnknownHostException { - this.context = new AnnotationConfigApplicationContext(BitronixJtaConfiguration.class); - String serverId = this.context.getBean(bitronix.tm.Configuration.class).getServerId(); - assertThat(serverId).isEqualTo(InetAddress.getLocalHost().getHostAddress()); - } - - @Test - @Deprecated - void customBitronixServerId() { - this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of("spring.jta.transactionManagerId:custom").applyTo(this.context); - this.context.register(BitronixJtaConfiguration.class); - this.context.refresh(); - String serverId = this.context.getBean(bitronix.tm.Configuration.class).getServerId(); - assertThat(serverId).isEqualTo("custom"); - } - @Test void defaultAtomikosTransactionManagerName(@TempDir Path dir) throws IOException { this.context = new AnnotationConfigApplicationContext(); @@ -166,20 +131,6 @@ class JtaAutoConfigurationTests { assertThat(connectionFactory.getMaxPoolSize()).isEqualTo(10); } - @Test - @Deprecated - void bitronixConnectionFactoryPoolConfiguration() { - this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of("spring.jta.bitronix.connectionfactory.minPoolSize:5", - "spring.jta.bitronix.connectionfactory.maxPoolSize:10").applyTo(this.context); - this.context.register(BitronixJtaConfiguration.class, PoolConfiguration.class); - this.context.refresh(); - org.springframework.boot.jta.bitronix.PoolingConnectionFactoryBean connectionFactory = this.context - .getBean(org.springframework.boot.jta.bitronix.PoolingConnectionFactoryBean.class); - assertThat(connectionFactory.getMinPoolSize()).isEqualTo(5); - assertThat(connectionFactory.getMaxPoolSize()).isEqualTo(10); - } - @Test void atomikosDataSourcePoolConfiguration() { this.context = new AnnotationConfigApplicationContext(); @@ -193,21 +144,6 @@ class JtaAutoConfigurationTests { assertThat(dataSource.getMaxPoolSize()).isEqualTo(10); } - @Test - @Deprecated - void bitronixDataSourcePoolConfiguration() { - this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues - .of("spring.jta.bitronix.datasource.minPoolSize:5", "spring.jta.bitronix.datasource.maxPoolSize:10") - .applyTo(this.context); - this.context.register(BitronixJtaConfiguration.class, PoolConfiguration.class); - this.context.refresh(); - org.springframework.boot.jta.bitronix.PoolingDataSourceBean dataSource = this.context - .getBean(org.springframework.boot.jta.bitronix.PoolingDataSourceBean.class); - assertThat(dataSource.getMinPoolSize()).isEqualTo(5); - assertThat(dataSource.getMaxPoolSize()).isEqualTo(10); - } - @Test void atomikosCustomizeJtaTransactionManagerUsingProperties() { this.context = new AnnotationConfigApplicationContext(); @@ -221,20 +157,6 @@ class JtaAutoConfigurationTests { assertThat(transactionManager.isRollbackOnCommitFailure()).isTrue(); } - @Test - @Deprecated - void bitronixCustomizeJtaTransactionManagerUsingProperties() { - this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues - .of("spring.transaction.default-timeout:30", "spring.transaction.rollback-on-commit-failure:true") - .applyTo(this.context); - this.context.register(BitronixJtaConfiguration.class, TransactionAutoConfiguration.class); - this.context.refresh(); - JtaTransactionManager transactionManager = this.context.getBean(JtaTransactionManager.class); - assertThat(transactionManager.getDefaultTimeout()).isEqualTo(30); - assertThat(transactionManager.isRollbackOnCommitFailure()).isTrue(); - } - @Configuration(proxyBeanMethods = false) static class CustomTransactionManagerConfig { diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index b2ae61391f..6a2b3b988f 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -128,13 +128,6 @@ bom { ] } } - library("Bitronix", "2.1.4") { - group("org.codehaus.btm") { - modules = [ - "btm" - ] - } - } library("Build Helper Maven Plugin", "3.2.0") { group("org.codehaus.mojo") { plugins = [ @@ -1421,7 +1414,6 @@ bom { "spring-boot-starter-jooq", "spring-boot-starter-json", "spring-boot-starter-jta-atomikos", - "spring-boot-starter-jta-bitronix", "spring-boot-starter-log4j2", "spring-boot-starter-logging", "spring-boot-starter-mail", diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc index 3833ae9c1b..c0f491b016 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc @@ -6472,7 +6472,6 @@ When a `jndi-name` is set, it takes precedence over all other Session-related se [[boot-features-jta]] == Distributed Transactions with JTA Spring Boot supports distributed JTA transactions across multiple XA resources by using an https://www.atomikos.com/[Atomikos] embedded transaction manager. -Deprecated support for using a https://github.com/bitronix/btm[Bitronix] embedded transaction manager is also provided but it will be removed in a future release. JTA transactions are also supported when deploying to a suitable Java EE Application Server. When a JTA environment is detected, Spring's `JtaTransactionManager` is used to manage transactions. @@ -6499,24 +6498,6 @@ To ensure uniqueness in production, you should configure the configprop:spring.j -[[boot-features-jta-bitronix]] -=== Using a Bitronix Transaction Manager -NOTE: As of Spring Boot 2.3, support for Bitronix has been deprecated and will be removed in a future release. - -You can use the `spring-boot-starter-jta-bitronix` starter to add the appropriate Bitronix dependencies to your project. -As with Atomikos, Spring Boot automatically configures Bitronix and post-processes your beans to ensure that startup and shutdown ordering is correct. - -By default, Bitronix transaction log files (`part1.btm` and `part2.btm`) are written to a `transaction-logs` directory in your application home directory. -You can customize the location of this directory by setting the configprop:spring.jta.log-dir[] property. -Properties starting with `spring.jta.bitronix.properties` are also bound to the `bitronix.tm.Configuration` bean, allowing for complete customization. -See the https://github.com/bitronix/btm/wiki/Transaction-manager-configuration[Bitronix documentation] for details. - -NOTE: To ensure that multiple transaction managers can safely coordinate the same resource managers, each Bitronix instance must be configured with a unique ID. -By default, this ID is the IP address of the machine on which Bitronix is running. -To ensure uniqueness in production, you should configure the configprop:spring.jta.transaction-manager-id[] property with a different value for each instance of your application. - - - [[boot-features-jta-javaee]] === Using a Java EE Managed Transaction Manager If you package your Spring Boot application as a `war` or `ear` file and deploy it to a Java EE application server, you can use your application server's built-in transaction manager. diff --git a/spring-boot-project/spring-boot-starters/spring-boot-starter-jta-bitronix/build.gradle b/spring-boot-project/spring-boot-starters/spring-boot-starter-jta-bitronix/build.gradle deleted file mode 100644 index 782e07209f..0000000000 --- a/spring-boot-project/spring-boot-starters/spring-boot-starter-jta-bitronix/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -plugins { - id "org.springframework.boot.starter" -} - -description = "Starter for JTA transactions using Bitronix. Deprecated since 2.3.0" - -dependencies { - api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter")) - api("jakarta.jms:jakarta.jms-api") - api("jakarta.transaction:jakarta.transaction-api") - api("org.codehaus.btm:btm") { - exclude group: "javax.transaction", module: "jta" - } -} diff --git a/spring-boot-project/spring-boot/build.gradle b/spring-boot-project/spring-boot/build.gradle index 90d6bc9dbb..17a21e8006 100644 --- a/spring-boot-project/spring-boot/build.gradle +++ b/spring-boot-project/spring-boot/build.gradle @@ -44,7 +44,6 @@ dependencies { optional("org.apache.tomcat.embed:tomcat-embed-jasper") optional("org.apache.tomcat:tomcat-jdbc") optional("org.assertj:assertj-core") - optional("org.codehaus.btm:btm") optional("org.codehaus.groovy:groovy") optional("org.codehaus.groovy:groovy-xml") optional("org.eclipse.jetty:jetty-servlets") diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessor.java deleted file mode 100644 index 3cebd875ac..0000000000 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessor.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2012-2020 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.jta.bitronix; - -import javax.transaction.TransactionManager; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.config.BeanFactoryPostProcessor; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.core.Ordered; - -/** - * {@link BeanFactoryPostProcessor} to automatically register the recommended - * {@link ConfigurableListableBeanFactory#registerDependentBean(String, String) - * dependencies} for correct Bitronix shutdown ordering. With Bitronix it appears that - * ConnectionFactory and DataSource beans must be shutdown before the - * {@link TransactionManager}. - * - * @author Phillip Webb - * @since 1.2.0 - * @deprecated since 2.3.0 as the Bitronix project is no longer being maintained - */ -@Deprecated -public class BitronixDependentBeanFactoryPostProcessor implements BeanFactoryPostProcessor, Ordered { - - private static final String[] NO_BEANS = {}; - - private int order = Ordered.LOWEST_PRECEDENCE; - - @Override - public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { - String[] transactionManagers = beanFactory.getBeanNamesForType(TransactionManager.class, true, false); - for (String transactionManager : transactionManagers) { - addTransactionManagerDependencies(beanFactory, transactionManager); - } - } - - private void addTransactionManagerDependencies(ConfigurableListableBeanFactory beanFactory, - String transactionManager) { - for (String dependentBeanName : getBeanNamesForType(beanFactory, "javax.jms.ConnectionFactory")) { - beanFactory.registerDependentBean(transactionManager, dependentBeanName); - } - for (String dependentBeanName : getBeanNamesForType(beanFactory, "javax.sql.DataSource")) { - beanFactory.registerDependentBean(transactionManager, dependentBeanName); - } - } - - private String[] getBeanNamesForType(ConfigurableListableBeanFactory beanFactory, String type) { - try { - return beanFactory.getBeanNamesForType(Class.forName(type), true, false); - } - catch (ClassNotFoundException | NoClassDefFoundError ex) { - // Ignore - } - return NO_BEANS; - } - - @Override - public int getOrder() { - return this.order; - } - - public void setOrder(int order) { - this.order = order; - } - -} diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapper.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapper.java deleted file mode 100644 index fc1b0d7eab..0000000000 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapper.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2012-2020 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.jta.bitronix; - -import javax.jms.ConnectionFactory; -import javax.jms.XAConnectionFactory; - -import org.springframework.boot.jms.XAConnectionFactoryWrapper; - -/** - * {@link XAConnectionFactoryWrapper} that uses a Bitronix - * {@link PoolingConnectionFactoryBean} to wrap a {@link XAConnectionFactory}. - * - * @author Phillip Webb - * @since 1.2.0 - * @deprecated since 2.3.0 as the Bitronix project is no longer being maintained - */ -@Deprecated -public class BitronixXAConnectionFactoryWrapper implements XAConnectionFactoryWrapper { - - @Override - public ConnectionFactory wrapConnectionFactory(XAConnectionFactory connectionFactory) { - PoolingConnectionFactoryBean pool = new PoolingConnectionFactoryBean(); - pool.setConnectionFactory(connectionFactory); - return pool; - } - -} diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapper.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapper.java deleted file mode 100644 index c766a82dab..0000000000 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapper.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2012-2020 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.jta.bitronix; - -import javax.sql.XADataSource; - -import org.springframework.boot.jdbc.XADataSourceWrapper; - -/** - * {@link XADataSourceWrapper} that uses a Bitronix {@link PoolingDataSourceBean} to wrap - * a {@link XADataSource}. - * - * @author Phillip Webb - * @since 1.2.0 - * @deprecated since 2.3.0 as the Bitronix project is no longer being maintained - */ -@Deprecated -public class BitronixXADataSourceWrapper implements XADataSourceWrapper { - - @Override - public PoolingDataSourceBean wrapDataSource(XADataSource dataSource) throws Exception { - PoolingDataSourceBean pool = new PoolingDataSourceBean(); - pool.setDataSource(dataSource); - return pool; - } - -} diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java deleted file mode 100644 index 484c4c26be..0000000000 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2012-2020 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.jta.bitronix; - -import java.util.Properties; - -import javax.jms.JMSException; -import javax.jms.XAConnection; -import javax.jms.XAConnectionFactory; -import javax.jms.XAJMSContext; - -import bitronix.tm.resource.common.ResourceBean; -import bitronix.tm.resource.common.XAStatefulHolder; -import bitronix.tm.resource.jms.PoolingConnectionFactory; - -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.util.StringUtils; - -/** - * Spring friendly version of {@link PoolingConnectionFactory}. Provides sensible defaults - * and also supports direct wrapping of a {@link XAConnectionFactory} instance. - * - * @author Phillip Webb - * @author Josh Long - * @author Andy Wilkinson - * @since 1.2.0 - * @deprecated since 2.3.0 as the Bitronix project is no longer being maintained - */ -@Deprecated -@SuppressWarnings("serial") -@ConfigurationProperties(prefix = "spring.jta.bitronix.connectionfactory") -public class PoolingConnectionFactoryBean extends PoolingConnectionFactory - implements BeanNameAware, InitializingBean, DisposableBean { - - private static final ThreadLocal source = new ThreadLocal<>(); - - private String beanName; - - private XAConnectionFactory connectionFactory; - - public PoolingConnectionFactoryBean() { - setMaxPoolSize(10); - setTestConnections(true); - setAutomaticEnlistingEnabled(true); - setAllowLocalTransactions(true); - } - - @Override - public synchronized void init() { - source.set(this); - try { - super.init(); - } - finally { - source.remove(); - } - } - - @Override - public void setBeanName(String name) { - this.beanName = name; - } - - @Override - public void afterPropertiesSet() throws Exception { - if (!StringUtils.hasLength(getUniqueName())) { - setUniqueName(this.beanName); - } - init(); - } - - @Override - public void destroy() throws Exception { - close(); - } - - /** - * Set the {@link XAConnectionFactory} directly, instead of calling - * {@link #setClassName(String)}. - * @param connectionFactory the connection factory to use - */ - public void setConnectionFactory(XAConnectionFactory connectionFactory) { - this.connectionFactory = connectionFactory; - setClassName(DirectXAConnectionFactory.class.getName()); - setDriverProperties(new Properties()); - } - - protected final XAConnectionFactory getConnectionFactory() { - return this.connectionFactory; - } - - @Override - public XAStatefulHolder createPooledConnection(Object xaFactory, ResourceBean bean) throws Exception { - if (xaFactory instanceof DirectXAConnectionFactory) { - xaFactory = ((DirectXAConnectionFactory) xaFactory).getConnectionFactory(); - } - return super.createPooledConnection(xaFactory, bean); - } - - /** - * A {@link XAConnectionFactory} implementation that delegates to the - * {@link ThreadLocal} {@link PoolingConnectionFactoryBean}. - * - * @see PoolingConnectionFactoryBean#setConnectionFactory(XAConnectionFactory) - */ - public static class DirectXAConnectionFactory implements XAConnectionFactory { - - private final XAConnectionFactory connectionFactory; - - public DirectXAConnectionFactory() { - this.connectionFactory = source.get().connectionFactory; - } - - @Override - public XAConnection createXAConnection() throws JMSException { - return this.connectionFactory.createXAConnection(); - } - - @Override - public XAConnection createXAConnection(String userName, String password) throws JMSException { - return this.connectionFactory.createXAConnection(userName, password); - } - - public XAConnectionFactory getConnectionFactory() { - return this.connectionFactory; - } - - @Override - public XAJMSContext createXAContext() { - return this.connectionFactory.createXAContext(); - } - - @Override - public XAJMSContext createXAContext(String username, String password) { - return this.connectionFactory.createXAContext(username, password); - } - - } - -} diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java deleted file mode 100644 index 21a80bb935..0000000000 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2012-2020 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.jta.bitronix; - -import java.io.PrintWriter; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.util.Properties; -import java.util.logging.Logger; - -import javax.sql.XAConnection; -import javax.sql.XADataSource; - -import bitronix.tm.resource.common.ResourceBean; -import bitronix.tm.resource.common.XAStatefulHolder; -import bitronix.tm.resource.jdbc.PoolingDataSource; - -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.util.StringUtils; - -/** - * Spring friendly version of {@link PoolingDataSource}. Provides sensible defaults and - * also supports direct wrapping of a {@link XADataSource} instance. - * - * @author Phillip Webb - * @author Josh Long - * @author Andy Wilkinson - * @since 1.2.0 - * @deprecated since 2.3.0 as the Bitronix project is no longer being maintained - */ -@Deprecated -@SuppressWarnings("serial") -@ConfigurationProperties(prefix = "spring.jta.bitronix.datasource") -public class PoolingDataSourceBean extends PoolingDataSource implements BeanNameAware, InitializingBean { - - private static final ThreadLocal source = new ThreadLocal<>(); - - private XADataSource dataSource; - - private String beanName; - - public PoolingDataSourceBean() { - setMaxPoolSize(10); - setAllowLocalTransactions(true); - setEnableJdbc4ConnectionTest(true); - } - - @Override - public synchronized void init() { - source.set(this); - try { - super.init(); - } - finally { - source.remove(); - } - } - - @Override - public void setBeanName(String name) { - this.beanName = name; - } - - @Override - public void afterPropertiesSet() throws Exception { - if (!StringUtils.hasLength(getUniqueName())) { - setUniqueName(this.beanName); - } - } - - /** - * Set the {@link XADataSource} directly, instead of calling - * {@link #setClassName(String)}. - * @param dataSource the data source to use - */ - public void setDataSource(XADataSource dataSource) { - this.dataSource = dataSource; - setClassName(DirectXADataSource.class.getName()); - setDriverProperties(new Properties()); - } - - protected final XADataSource getDataSource() { - return this.dataSource; - } - - @Override - public XAStatefulHolder createPooledConnection(Object xaFactory, ResourceBean bean) throws Exception { - if (xaFactory instanceof DirectXADataSource) { - xaFactory = ((DirectXADataSource) xaFactory).getDataSource(); - } - return super.createPooledConnection(xaFactory, bean); - } - - @Override - public Logger getParentLogger() throws SQLFeatureNotSupportedException { - XADataSource dataSource = this.dataSource; - if (dataSource != null) { - try { - return dataSource.getParentLogger(); - } - catch (Exception ex) { - // Swallow and continue - } - } - return Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); - } - - /** - * A {@link XADataSource} implementation that delegates to the {@link ThreadLocal} - * {@link PoolingDataSourceBean}. - * - * @see PoolingDataSourceBean#setDataSource(XADataSource) - */ - public static class DirectXADataSource implements XADataSource { - - private final XADataSource dataSource; - - public DirectXADataSource() { - this.dataSource = source.get().dataSource; - } - - @Override - public PrintWriter getLogWriter() throws SQLException { - return this.dataSource.getLogWriter(); - } - - @Override - public XAConnection getXAConnection() throws SQLException { - return this.dataSource.getXAConnection(); - } - - @Override - public XAConnection getXAConnection(String user, String password) throws SQLException { - return this.dataSource.getXAConnection(user, password); - } - - @Override - public void setLogWriter(PrintWriter out) throws SQLException { - this.dataSource.setLogWriter(out); - } - - @Override - public void setLoginTimeout(int seconds) throws SQLException { - this.dataSource.setLoginTimeout(seconds); - } - - @Override - public int getLoginTimeout() throws SQLException { - return this.dataSource.getLoginTimeout(); - } - - @Override - public Logger getParentLogger() throws SQLFeatureNotSupportedException { - return this.dataSource.getParentLogger(); - } - - public XADataSource getDataSource() { - return this.dataSource; - } - - } - -} diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/package-info.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/package-info.java deleted file mode 100644 index 71a5709d26..0000000000 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2012-2020 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. - */ - -/** - * Support classes for Bitronix JTA. - * @deprecated since 2.3.0 as the Bitronix project is no longer being maintained - */ -package org.springframework.boot.jta.bitronix; diff --git a/spring-boot-project/spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json index fdf2a44eb6..c235973500 100644 --- a/spring-boot-project/spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -469,273 +469,331 @@ { "name": "spring.jta.bitronix.connectionfactory.acquire-increment", "type": "java.lang.Integer", - "description": "Number of connections to create when growing the pool.", - "defaultValue": 1 + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.acquisition-interval", "type": "java.lang.Integer", - "description": "Time, in seconds, to wait before trying to acquire a connection again after an invalid connection was acquired.", - "defaultValue": 1 + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.acquisition-timeout", "type": "java.lang.Integer", - "description": "Timeout, in seconds, for acquiring connections from the pool.", - "defaultValue": 30 + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.allow-local-transactions", "type": "java.lang.Boolean", - "description": "Whether the transaction manager should allow mixing XA and non-XA transactions.", - "defaultValue": false + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.apply-transaction-timeout", "type": "java.lang.Boolean", - "description": "Whether the transaction timeout should be set on the XAResource when it is enlisted.", - "defaultValue": false + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.automatic-enlisting-enabled", "type": "java.lang.Boolean", - "description": "Whether resources should be enlisted and delisted automatically.", - "defaultValue": true + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.cache-producers-consumers", "type": "java.lang.Boolean", - "description": "Whether producers and consumers should be cached.", - "defaultValue": true + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.class-name", "type": "java.lang.String", - "description": "Underlying implementation class name of the XA resource." + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.defer-connection-release", "type": "java.lang.Boolean", - "description": "Whether the provider can run many transactions on the same connection and supports transaction interleaving.", - "defaultValue": true + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.disabled", "type": "java.lang.Boolean", - "description": "Whether this resource is disabled, meaning it's temporarily forbidden to acquire a connection from its pool.", - "defaultValue": false + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.driver-properties", "type": "java.util.Properties", - "description": "Properties that should be set on the underlying implementation." + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.ignore-recovery-failures", "type": "java.lang.Boolean", - "description": "Whether recovery failures should be ignored.", - "defaultValue": false + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.max-idle-time", "type": "java.lang.Integer", - "description": "Time, in seconds, after which connections are cleaned up from the pool.", - "defaultValue": 60 + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.max-pool-size", "type": "java.lang.Integer", - "description": "Maximum size of the pool. 0 denotes no limit.", - "defaultValue": 0 + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.min-pool-size", "type": "java.lang.Integer", - "description": "Minimum size of the pool.", - "defaultValue": 0 + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.password", "type": "java.lang.String", - "description": "Password to use to connect to the JMS provider." + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.share-transaction-connections", "type": "java.lang.Boolean", - "description": "Whether connections in the ACCESSIBLE state can be shared within the context of a transaction.", - "defaultValue": false + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.test-connections", "type": "java.lang.Boolean", - "description": "Whether connections should be tested when acquired from the pool.", - "defaultValue": false + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.two-pc-ordering-position", "type": "java.lang.Integer", - "description": "Position that this resource should take during two-phase commit (always first is Integer.MIN_VALUE, always last is Integer.MAX_VALUE).", - "defaultValue": 1 + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.unique-name", "type": "java.lang.String", - "description": "Unique name used to identify the resource during recovery.", - "defaultValue": "jmsConnectionFactory" + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.use-tm-join", "type": "java.lang.Boolean", - "description": "Whether TMJOIN should be used when starting XAResources.", - "defaultValue": true + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.connectionfactory.user", "type": "java.lang.String", - "description": "User to use to connect to the JMS provider." + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.acquire-increment", "type": "java.lang.Integer", - "description": "Number of connections to create when growing the pool.", - "defaultValue": 1 + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.acquisition-interval", "type": "java.lang.Integer", - "description": "Time, in seconds, to wait before trying to acquire a connection again after an invalid connection was acquired.", - "defaultValue": 1 + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.acquisition-timeout", "type": "java.lang.Integer", - "description": "Timeout, in seconds, for acquiring connections from the pool.", - "defaultValue": 30 + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.allow-local-transactions", "type": "java.lang.Boolean", - "description": "Whether the transaction manager should allow mixing XA and non-XA transactions.", - "defaultValue": false + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.apply-transaction-timeout", "type": "java.lang.Boolean", - "description": "Whether the transaction timeout should be set on the XAResource when it is enlisted.", - "defaultValue": "false" + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.automatic-enlisting-enabled", "type": "java.lang.Boolean", - "description": "Whether resources should be enlisted and delisted automatically.", - "defaultValue": true + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.class-name", "type": "java.lang.String", - "description": "Underlying implementation class name of the XA resource." + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.cursor-holdability", "type": "java.lang.String", - "description": "Default cursor holdability for connections." + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.defer-connection-release", "type": "java.lang.Boolean", - "description": "Whether the database can run many transactions on the same connection and supports transaction interleaving.", - "defaultValue": true + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.disabled", "type": "java.lang.Boolean", - "description": "Whether this resource is disabled, meaning it's temporarily forbidden to acquire a connection from its pool.", - "defaultValue": false + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.driver-properties", "type": "java.util.Properties", - "description": "Properties that should be set on the underlying implementation." + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.enable-jdbc4-connection-test", "type": "java.lang.Boolean", - "description": "Whether Connection.isValid() is called when acquiring a connection from the pool.", - "defaultValue": false + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.ignore-recovery-failures", "type": "java.lang.Boolean", - "description": "Whether recovery failures should be ignored.", - "defaultValue": false + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.isolation-level", "type": "java.lang.String", - "description": "Default isolation level for connections." + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.local-auto-commit", "type": "java.lang.String", - "description": "Default auto-commit mode for local transactions." + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.login-timeout", "type": "java.lang.Integer", - "description": "Timeout, in seconds, for establishing a database connection." + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.max-idle-time", "type": "java.lang.Integer", - "description": "Time, in seconds, after which connections are cleaned up from the pool.", - "defaultValue": 60 + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.max-pool-size", "type": "java.lang.Integer", - "description": "Maximum size of the pool. 0 denotes no limit.", - "defaultValue": 0 + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.min-pool-size", "type": "java.lang.Integer", - "description": "Minimum size of the pool.", - "defaultValue": 0 + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.prepared-statement-cache-size", "type": "java.lang.Integer", - "description": "Target size of the prepared statement cache. 0 disables the cache.", - "defaultValue": 0 + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.share-transaction-connections", "type": "java.lang.Boolean", - "description": "Whether connections in the ACCESSIBLE state can be shared within the context of a transaction.", - "defaultValue": false + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.test-query", "type": "java.lang.String", - "description": "SQL query or statement used to validate a connection before returning it." + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.two-pc-ordering-position", "type": "java.lang.Integer", - "description": "Position that this resource should take during two-phase commit (always first is Integer.MIN_VALUE, and always last is Integer.MAX_VALUE).", - "defaultValue": 1 + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.unique-name", "type": "java.lang.String", - "description": "Unique name used to identify the resource during recovery.", - "defaultValue": "dataSource" + "deprecation": { + "level": "error" + } }, { "name": "spring.jta.bitronix.datasource.use-tm-join", "type": "java.lang.Boolean", - "description": "Whether TMJOIN should be used when starting XAResources.", - "defaultValue": true + "deprecation": { + "level": "error" + } }, { "name": "spring.main.allow-bean-definition-overriding", diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessorTests.java deleted file mode 100644 index ab8f474f95..0000000000 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessorTests.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2012-2020 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.jta.bitronix; - -import javax.jms.ConnectionFactory; -import javax.sql.DataSource; - -import bitronix.tm.BitronixTransactionManager; -import org.junit.jupiter.api.Test; - -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - -/** - * Tests for {@link BitronixDependentBeanFactoryPostProcessor}. - * - * @author Phillip Webb - */ -@Deprecated -class BitronixDependentBeanFactoryPostProcessorTests { - - private AnnotationConfigApplicationContext context; - - @Test - void setsDependsOn() { - DefaultListableBeanFactory beanFactory = spy(new DefaultListableBeanFactory()); - this.context = new AnnotationConfigApplicationContext(beanFactory); - this.context.register(Config.class); - this.context.refresh(); - String name = "bitronixTransactionManager"; - verify(beanFactory).registerDependentBean(name, "dataSource"); - verify(beanFactory).registerDependentBean(name, "connectionFactory"); - this.context.close(); - } - - @Configuration(proxyBeanMethods = false) - static class Config { - - @Bean - DataSource dataSource() { - return mock(DataSource.class); - } - - @Bean - ConnectionFactory connectionFactory() { - return mock(ConnectionFactory.class); - } - - @Bean - BitronixTransactionManager bitronixTransactionManager() { - return mock(BitronixTransactionManager.class); - } - - @Bean - static BitronixDependentBeanFactoryPostProcessor bitronixPostProcessor() { - return new BitronixDependentBeanFactoryPostProcessor(); - } - - } - -} diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapperTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapperTests.java deleted file mode 100644 index 6369668111..0000000000 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/BitronixXAConnectionFactoryWrapperTests.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2012-2020 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.jta.bitronix; - -import javax.jms.ConnectionFactory; -import javax.jms.XAConnectionFactory; - -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - -/** - * Tests for {@link BitronixXAConnectionFactoryWrapper}. - * - * @author Phillip Webb - */ -@Deprecated -class BitronixXAConnectionFactoryWrapperTests { - - @Test - void wrap() { - XAConnectionFactory connectionFactory = mock(XAConnectionFactory.class); - BitronixXAConnectionFactoryWrapper wrapper = new BitronixXAConnectionFactoryWrapper(); - ConnectionFactory wrapped = wrapper.wrapConnectionFactory(connectionFactory); - assertThat(wrapped).isInstanceOf(PoolingConnectionFactoryBean.class); - assertThat(((PoolingConnectionFactoryBean) wrapped).getConnectionFactory()).isSameAs(connectionFactory); - } - -} diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapperTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapperTests.java deleted file mode 100644 index f47bf4c45c..0000000000 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/BitronixXADataSourceWrapperTests.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2012-2020 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.jta.bitronix; - -import javax.sql.DataSource; -import javax.sql.XADataSource; - -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - -/** - * Tests for {@link BitronixXADataSourceWrapper}. - * - * @author Phillip Webb - */ -@Deprecated -class BitronixXADataSourceWrapperTests { - - @Test - void wrap() throws Exception { - XADataSource dataSource = mock(XADataSource.class); - BitronixXADataSourceWrapper wrapper = new BitronixXADataSourceWrapper(); - DataSource wrapped = wrapper.wrapDataSource(dataSource); - assertThat(wrapped).isInstanceOf(PoolingDataSourceBean.class); - assertThat(((PoolingDataSourceBean) wrapped).getDataSource()).isSameAs(dataSource); - } - -} diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBeanTests.java deleted file mode 100644 index 9655b5fb0e..0000000000 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBeanTests.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2012-2020 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.jta.bitronix; - -import javax.jms.XAConnectionFactory; - -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -/** - * Tests for {@link PoolingConnectionFactoryBean}. - * - * @author Phillip Webb - */ -@Deprecated -class PoolingConnectionFactoryBeanTests { - - @SuppressWarnings("serial") - private PoolingConnectionFactoryBean bean = new PoolingConnectionFactoryBean() { - @Override - public synchronized void init() { - // Stub out for the tests - } - }; - - @Test - void sensibleDefaults() { - assertThat(this.bean.getMaxPoolSize()).isEqualTo(10); - assertThat(this.bean.getTestConnections()).isTrue(); - assertThat(this.bean.getAutomaticEnlistingEnabled()).isTrue(); - assertThat(this.bean.getAllowLocalTransactions()).isTrue(); - } - - @Test - void setsUniqueNameIfNull() throws Exception { - this.bean.setBeanName("beanName"); - this.bean.afterPropertiesSet(); - assertThat(this.bean.getUniqueName()).isEqualTo("beanName"); - } - - @Test - void doesNotSetUniqueNameIfNotNull() throws Exception { - this.bean.setBeanName("beanName"); - this.bean.setUniqueName("un"); - this.bean.afterPropertiesSet(); - assertThat(this.bean.getUniqueName()).isEqualTo("un"); - } - - @Test - void setConnectionFactory() throws Exception { - XAConnectionFactory factory = mock(XAConnectionFactory.class); - this.bean.setConnectionFactory(factory); - this.bean.setBeanName("beanName"); - this.bean.afterPropertiesSet(); - this.bean.init(); - this.bean.createPooledConnection(factory, this.bean); - verify(factory).createXAConnection(); - } - -} diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBeanTests.java deleted file mode 100644 index a45ad23070..0000000000 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBeanTests.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2012-2020 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.jta.bitronix; - -import java.sql.Connection; -import java.sql.SQLFeatureNotSupportedException; -import java.util.logging.Logger; - -import javax.sql.XAConnection; -import javax.sql.XADataSource; - -import bitronix.tm.TransactionManagerServices; -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -/** - * Tests for {@link PoolingDataSourceBean}. - * - * @author Phillip Webb - */ -@Deprecated -class PoolingDataSourceBeanTests { - - private PoolingDataSourceBean bean = new PoolingDataSourceBean(); - - @Test - void sensibleDefaults() { - assertThat(this.bean.getMaxPoolSize()).isEqualTo(10); - assertThat(this.bean.getAutomaticEnlistingEnabled()).isTrue(); - assertThat(this.bean.isEnableJdbc4ConnectionTest()).isTrue(); - } - - @Test - void setsUniqueNameIfNull() throws Exception { - this.bean.setBeanName("beanName"); - this.bean.afterPropertiesSet(); - assertThat(this.bean.getUniqueName()).isEqualTo("beanName"); - } - - @Test - void doesNotSetUniqueNameIfNotNull() throws Exception { - this.bean.setBeanName("beanName"); - this.bean.setUniqueName("un"); - this.bean.afterPropertiesSet(); - assertThat(this.bean.getUniqueName()).isEqualTo("un"); - } - - @Test - void shouldReturnGlobalLoggerWhenDataSourceIsAbsent() throws SQLFeatureNotSupportedException { - assertThat(this.bean.getParentLogger()).isSameAs(Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)); - } - - @Test - void shouldReturnGlobalLoggerWhenDataSourceThrowsException() throws SQLFeatureNotSupportedException { - XADataSource dataSource = mock(XADataSource.class); - given(dataSource.getParentLogger()).willThrow(new SQLFeatureNotSupportedException()); - this.bean.setDataSource(dataSource); - assertThat(this.bean.getParentLogger()).isSameAs(Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)); - } - - @Test - void shouldReturnParentLoggerFromDataSource() throws SQLFeatureNotSupportedException { - Logger logger = Logger.getLogger("test"); - XADataSource dataSource = mock(XADataSource.class); - given(dataSource.getParentLogger()).willReturn(logger); - this.bean.setDataSource(dataSource); - assertThat(this.bean.getParentLogger()).isSameAs(logger); - } - - @Test - void setDataSource() throws Exception { - XADataSource dataSource = mock(XADataSource.class); - XAConnection xaConnection = mock(XAConnection.class); - Connection connection = mock(Connection.class); - given(dataSource.getXAConnection()).willReturn(xaConnection); - given(xaConnection.getConnection()).willReturn(connection); - this.bean.setDataSource(dataSource); - this.bean.setBeanName("beanName"); - this.bean.afterPropertiesSet(); - this.bean.init(); - this.bean.createPooledConnection(dataSource, this.bean); - verify(dataSource).getXAConnection(); - TransactionManagerServices.getTaskScheduler().shutdown(); - } - -} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/build.gradle b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/build.gradle deleted file mode 100644 index 55e14c4ede..0000000000 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -plugins { - id "java" - id "org.springframework.boot.conventions" -} - -description = "Spring Boot Bitronix JTA smoke test" - -dependencies { - implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-artemis")) - implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-data-jpa")) - implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-jta-bitronix")) - if (JavaVersion.current().java9Compatible) { - implementation("jakarta.xml.bind:jakarta.xml.bind-api") - } - implementation("org.springframework:spring-jms") - - runtimeOnly("com.h2database:h2") - runtimeOnly("org.apache.activemq:artemis-jms-server") { - exclude group: "org.apache.geronimo.specs", module: "geronimo-jms_2.0_spec" - } - - testImplementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-test")) -} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/Account.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/Account.java deleted file mode 100644 index 548e56370e..0000000000 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/Account.java +++ /dev/null @@ -1,43 +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. - */ - -package smoketest.bitronix; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; - -@Entity -public class Account { - - @Id - @GeneratedValue - private Long id; - - private String username; - - Account() { - } - - public Account(String username) { - this.username = username; - } - - public String getUsername() { - return this.username; - } - -} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/AccountRepository.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/AccountRepository.java deleted file mode 100644 index f844533290..0000000000 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/AccountRepository.java +++ /dev/null @@ -1,23 +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. - */ - -package smoketest.bitronix; - -import org.springframework.data.jpa.repository.JpaRepository; - -public interface AccountRepository extends JpaRepository { - -} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/AccountService.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/AccountService.java deleted file mode 100644 index e3ef379b42..0000000000 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/AccountService.java +++ /dev/null @@ -1,45 +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. - */ - -package smoketest.bitronix; - -import javax.transaction.Transactional; - -import org.springframework.jms.core.JmsTemplate; -import org.springframework.stereotype.Service; - -@Service -@Transactional -public class AccountService { - - private final JmsTemplate jmsTemplate; - - private final AccountRepository accountRepository; - - public AccountService(JmsTemplate jmsTemplate, AccountRepository accountRepository) { - this.jmsTemplate = jmsTemplate; - this.accountRepository = accountRepository; - } - - public void createAccountAndNotify(String username) { - this.jmsTemplate.convertAndSend("accounts", username); - this.accountRepository.save(new Account(username)); - if ("error".equals(username)) { - throw new RuntimeException("Simulated error"); - } - } - -} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/Messages.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/Messages.java deleted file mode 100644 index edb9877dbb..0000000000 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/Messages.java +++ /dev/null @@ -1,30 +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. - */ - -package smoketest.bitronix; - -import org.springframework.jms.annotation.JmsListener; -import org.springframework.stereotype.Component; - -@Component -public class Messages { - - @JmsListener(destination = "accounts") - public void onMessage(String content) { - System.out.println("----> " + content); - } - -} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/SampleBitronixApplication.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/SampleBitronixApplication.java deleted file mode 100644 index 3d3652e372..0000000000 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/java/smoketest/bitronix/SampleBitronixApplication.java +++ /dev/null @@ -1,45 +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. - */ - -package smoketest.bitronix; - -import java.io.Closeable; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.ApplicationContext; - -@SpringBootApplication -public class SampleBitronixApplication { - - public static void main(String[] args) throws Exception { - ApplicationContext context = SpringApplication.run(SampleBitronixApplication.class, args); - AccountService service = context.getBean(AccountService.class); - AccountRepository repository = context.getBean(AccountRepository.class); - service.createAccountAndNotify("josh"); - System.out.println("Count is " + repository.count()); - try { - service.createAccountAndNotify("error"); - } - catch (Exception ex) { - System.out.println(ex.getMessage()); - } - System.out.println("Count is " + repository.count()); - Thread.sleep(100); - ((Closeable) context).close(); - } - -} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/resources/application.properties b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/resources/application.properties deleted file mode 100644 index ba2e3e18ba..0000000000 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/main/resources/application.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.artemis.embedded.queues=accounts -spring.jpa.open-in-view=true diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/test/java/smoketest/bitronix/SampleBitronixApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/test/java/smoketest/bitronix/SampleBitronixApplicationTests.java deleted file mode 100644 index 422980c4a0..0000000000 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-bitronix/src/test/java/smoketest/bitronix/SampleBitronixApplicationTests.java +++ /dev/null @@ -1,68 +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. - */ - -package smoketest.bitronix; - -import java.util.function.Consumer; - -import bitronix.tm.resource.jms.PoolingConnectionFactory; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.test.system.CapturedOutput; -import org.springframework.boot.test.system.OutputCaptureExtension; -import org.springframework.context.ApplicationContext; -import org.springframework.util.StringUtils; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Basic integration tests for demo application. - * - * @author Phillip Webb - */ -@ExtendWith(OutputCaptureExtension.class) -class SampleBitronixApplicationTests { - - @Test - void testTransactionRollback(CapturedOutput output) throws Exception { - SampleBitronixApplication.main(new String[] {}); - assertThat(output).satisfies(numberOfOccurrences("---->", 1)); - assertThat(output).satisfies(numberOfOccurrences("----> josh", 1)); - assertThat(output).satisfies(numberOfOccurrences("Count is 1", 2)); - assertThat(output).satisfies(numberOfOccurrences("Simulated error", 1)); - } - - @Test - void testExposesXaAndNonXa() { - ApplicationContext context = SpringApplication.run(SampleBitronixApplication.class); - Object jmsConnectionFactory = context.getBean("jmsConnectionFactory"); - Object xaJmsConnectionFactory = context.getBean("xaJmsConnectionFactory"); - Object nonXaJmsConnectionFactory = context.getBean("nonXaJmsConnectionFactory"); - assertThat(jmsConnectionFactory).isSameAs(xaJmsConnectionFactory); - assertThat(jmsConnectionFactory).isInstanceOf(PoolingConnectionFactory.class); - assertThat(nonXaJmsConnectionFactory).isNotInstanceOf(PoolingConnectionFactory.class); - } - - private Consumer numberOfOccurrences(String substring, int expectedCount) { - return (charSequence) -> { - int count = StringUtils.countOccurrencesOf(charSequence.toString(), substring); - assertThat(count).isEqualTo(expectedCount); - }; - } - -} From 2c2c1605795d9c05fc29f1b88050a2bb048a93c3 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 15 Jan 2021 09:53:45 +0100 Subject: [PATCH 2/2] Remove deprecated code See gh-24806 --- .../autoconfigure/metrics/MeterValue.java | 13 +- .../metrics/MetricsProperties.java | 9 +- .../ServiceLevelAgreementBoundary.java | 72 ------- .../metrics/PropertiesMeterFilterTests.java | 11 +- .../servlet/ManagementErrorEndpointTests.java | 11 +- .../cache/CachingOperationInvoker.java | 18 +- .../client/WebClientExchangeTags.java | 26 +-- .../batch/JobLauncherCommandLineRunner.java | 49 ----- .../cache/CouchbaseCacheConfiguration.java | 10 +- .../cassandra/CassandraProperties.java | 69 +------ .../rest/RestClientBuilderCustomizer.java | 36 ---- .../elasticsearch/rest/package-info.java | 21 -- .../mongo/MongoClientFactory.java | 28 +-- .../mongo/MongoClientFactorySupport.java | 11 +- .../mongo/ReactiveMongoClientFactory.java | 17 +- .../saml2/Saml2RelyingPartyProperties.java | 14 +- .../autoconfigure/web/ErrorProperties.java | 24 ++- .../autoconfigure/web/ServerProperties.java | 189 +----------------- .../web/format/WebConversionService.java | 14 +- .../web/reactive/WebFluxProperties.java | 14 +- .../error/AbstractErrorController.java | 17 +- .../servlet/error/BasicErrorController.java | 8 +- ...earchRestClientAutoConfigurationTests.java | 23 +-- .../Saml2RelyingPartyPropertiesTests.java | 12 +- .../web/ServerPropertiesTests.java | 73 +------ .../JettyWebServerFactoryCustomizerTests.java | 14 +- ...TomcatWebServerFactoryCustomizerTests.java | 22 +- .../WebFluxAutoConfigurationTests.java | 11 +- ...orWebExceptionHandlerIntegrationTests.java | 15 +- .../gradle/tasks/bundling/BootArchive.java | 24 +-- .../tasks/bundling/BootArchiveSupport.java | 22 +- .../boot/gradle/tasks/bundling/BootJar.java | 28 +-- .../boot/gradle/tasks/bundling/BootWar.java | 14 +- .../bundling/AbstractBootArchiveTests.java | 15 +- .../gradle/tasks/bundling/BootWarTests.java | 14 +- .../boot/loader/tools/Layout.java | 17 +- .../boot/loader/tools/Layouts.java | 14 +- .../boot/maven/AbstractRunMojo.java | 17 +- .../boot/SpringApplication.java | 14 +- .../undertow/UndertowServletWebServer.java | 55 +---- .../embedded/undertow/UndertowWebServer.java | 16 +- .../error/DefaultErrorAttributes.java | 29 +-- .../web/reactive/error/ErrorAttributes.java | 19 +- .../servlet/error/DefaultErrorAttributes.java | 29 +-- .../web/servlet/error/ErrorAttributes.java | 20 +- .../web/servlet/error/ErrorController.java | 12 +- .../error/DefaultErrorAttributesTests.java | 15 +- .../error/DefaultErrorAttributesTests.java | 13 +- 48 files changed, 89 insertions(+), 1149 deletions(-) delete mode 100644 spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/ServiceLevelAgreementBoundary.java delete mode 100644 spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java delete mode 100644 spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/RestClientBuilderCustomizer.java delete mode 100644 spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/package-info.java diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterValue.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterValue.java index 2d3f31b505..94ad8dd975 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterValue.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -93,17 +93,6 @@ public final class MeterValue { return new MeterValue(DurationStyle.detectAndParse(value)); } - /** - * Return a new {@link MeterValue} instance for the given long value. - * @param value the source value - * @return a {@link MeterValue} instance - * @deprecated as of 2.3.0 in favor of {@link #valueOf(double)} - */ - @Deprecated - public static MeterValue valueOf(long value) { - return new MeterValue(value); - } - /** * Return a new {@link MeterValue} instance for the given double value. * @param value the source value diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java index ecc4e6865b..c2b9be11d2 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -20,7 +20,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.boot.context.properties.NestedConfigurationProperty; /** @@ -262,12 +261,6 @@ public class MetricsProperties { return this.percentiles; } - @Deprecated - @DeprecatedConfigurationProperty(replacement = "management.metrics.distribution.slo") - public Map getSla() { - return this.slo; - } - public Map getSlo() { return this.slo; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/ServiceLevelAgreementBoundary.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/ServiceLevelAgreementBoundary.java deleted file mode 100644 index a6a8014a90..0000000000 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/ServiceLevelAgreementBoundary.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2012-2020 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.actuate.autoconfigure.metrics; - -import java.time.Duration; - -import io.micrometer.core.instrument.Meter; - -/** - * A boundary for a service-level agreement (SLA) for use when configuring Micrometer. Can - * be specified as either a {@link Long} (applicable to timers and distribution summaries) - * or a {@link Duration} (applicable to only timers). - * - * @author Phillip Webb - * @since 2.0.0 - * @deprecated as of 2.3.0 in favor of {@link ServiceLevelObjectiveBoundary} - */ -@Deprecated -public final class ServiceLevelAgreementBoundary { - - private final MeterValue value; - - ServiceLevelAgreementBoundary(MeterValue value) { - this.value = value; - } - - /** - * Return the underlying value of the SLA in form suitable to apply to the given meter - * type. - * @param meterType the meter type - * @return the value or {@code null} if the value cannot be applied - */ - public Long getValue(Meter.Type meterType) { - Double value = this.value.getValue(meterType); - return (value != null) ? value.longValue() : null; - } - - /** - * Return a new {@link ServiceLevelAgreementBoundary} instance for the given long - * value. - * @param value the source value - * @return a {@link ServiceLevelAgreementBoundary} instance - */ - public static ServiceLevelAgreementBoundary valueOf(long value) { - return new ServiceLevelAgreementBoundary(MeterValue.valueOf(value)); - } - - /** - * Return a new {@link ServiceLevelAgreementBoundary} instance for the given String - * value. - * @param value the source value - * @return a {@link ServiceLevelAgreementBoundary} instance - */ - public static ServiceLevelAgreementBoundary valueOf(String value) { - return new ServiceLevelAgreementBoundary(MeterValue.valueOf(value)); - } - -} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilterTests.java index 7ee94fc293..7d6611df10 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -203,15 +203,6 @@ class PropertiesMeterFilterTests { .containsExactly(1, 1.5, 2); } - @Test - @Deprecated - void configureWhenHasDeprecatedSlaShouldSetSlaToValue() { - PropertiesMeterFilter filter = new PropertiesMeterFilter( - createProperties("distribution.sla.spring.boot=1,2,3")); - assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT) - .getServiceLevelObjectiveBoundaries()).containsExactly(1000000, 2000000, 3000000); - } - @Test void configureWhenHasSloShouldSetSloToValue() { PropertiesMeterFilter filter = new PropertiesMeterFilter( diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpointTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpointTests.java index c72b31655b..0dc697ef6c 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpointTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -128,13 +128,12 @@ class ManagementErrorEndpointTests { } @Test - void errorResponseWithDefaultErrorAttributesSubclassUsingDeprecatedApiAndDelegation() { + void errorResponseWithDefaultErrorAttributesSubclassUsingDelegation() { ErrorAttributes attributes = new DefaultErrorAttributes() { @Override - @SuppressWarnings("deprecation") - public Map getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { - Map response = super.getErrorAttributes(webRequest, includeStackTrace); + public Map getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) { + Map response = super.getErrorAttributes(webRequest, options); response.put("error", "custom error"); response.put("custom", "value"); response.remove("path"); @@ -151,7 +150,7 @@ class ManagementErrorEndpointTests { } @Test - void errorResponseWithDefaultErrorAttributesSubclassUsingDeprecatedApiWithoutDelegation() { + void errorResponseWithDefaultErrorAttributesSubclassWithoutDelegation() { ErrorAttributes attributes = new DefaultErrorAttributes() { @Override diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoker/cache/CachingOperationInvoker.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoker/cache/CachingOperationInvoker.java index 0b3d4a52e8..be27aa3c0b 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoker/cache/CachingOperationInvoker.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoker/cache/CachingOperationInvoker.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -104,22 +104,6 @@ public class CachingOperationInvoker implements OperationInvoker { return new CachedResponse(response, accessTime); } - /** - * Apply caching configuration when appropriate to the given invoker. - * @param invoker the invoker to wrap - * @param timeToLive the maximum time in milliseconds that a response can be cached - * @return a caching version of the invoker or the original instance if caching is not - * required - * @deprecated as of 2.3.0 to make it package-private in 2.4 - */ - @Deprecated - public static OperationInvoker apply(OperationInvoker invoker, long timeToLive) { - if (timeToLive > 0) { - return new CachingOperationInvoker(invoker, timeToLive); - } - return invoker; - } - /** * A cached response that encapsulates the response itself and the time at which it * was created. diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/WebClientExchangeTags.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/WebClientExchangeTags.java index 4a94264265..6d0af88c6b 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/WebClientExchangeTags.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/WebClientExchangeTags.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -94,30 +94,6 @@ public final class WebClientExchangeTags { return CLIENT_ERROR; } - /** - * Creates a {@code status} {@code Tag} derived from the - * {@link ClientResponse#statusCode()} of the given {@code response}. - * @param response the response - * @return the status tag - * @deprecated since 2.3.0 in favor of {@link #status(ClientResponse, Throwable)} - */ - @Deprecated - public static Tag status(ClientResponse response) { - return Tag.of("status", String.valueOf(response.rawStatusCode())); - } - - /** - * Creates a {@code status} {@code Tag} derived from the exception thrown by the - * client. - * @param throwable the exception - * @return the status tag - * @deprecated since 2.3.0 in favor of {@link #status(ClientResponse, Throwable)} - */ - @Deprecated - public static Tag status(Throwable throwable) { - return (throwable instanceof IOException) ? IO_ERROR : CLIENT_ERROR; - } - /** * Create a {@code clientName} {@code Tag} derived from the * {@link java.net.URI#getHost host} of the {@link ClientRequest#url() URL} of the diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java deleted file mode 100644 index 7832c0a7fd..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2012-2020 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.batch; - -import org.springframework.batch.core.explore.JobExplorer; -import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.batch.core.repository.JobRepository; -import org.springframework.boot.ApplicationRunner; - -/** - * {@link ApplicationRunner} to {@link JobLauncher launch} Spring Batch jobs. Runs all - * jobs in the surrounding context by default. Can also be used to launch a specific job - * by providing a jobName. - * - * @author Dave Syer - * @author Jean-Pierre Bergamin - * @author Mahmoud Ben Hassine - * @since 1.0.0 - * @deprecated since 2.3.0 in favor of {@link JobLauncherApplicationRunner} - */ -@Deprecated -public class JobLauncherCommandLineRunner extends JobLauncherApplicationRunner { - - /** - * Create a new {@link JobLauncherCommandLineRunner}. - * @param jobLauncher to launch jobs - * @param jobExplorer to check the job repository for previous executions - * @param jobRepository to check if a job instance exists with the given parameters - * when running a job - */ - public JobLauncherCommandLineRunner(JobLauncher jobLauncher, JobExplorer jobExplorer, JobRepository jobRepository) { - super(jobLauncher, jobExplorer, jobRepository); - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CouchbaseCacheConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CouchbaseCacheConfiguration.java index 12028d2f2c..a4ba5952d7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CouchbaseCacheConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CouchbaseCacheConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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,20 +39,16 @@ import org.springframework.util.ObjectUtils; * Couchbase cache configuration. * * @author Stephane Nicoll - * @since 1.4.0 - * @deprecated since 2.3.3 as this class is not intended for public use. It will be made - * package-private in a future release */ @Configuration(proxyBeanMethods = false) @ConditionalOnClass({ Cluster.class, CouchbaseClientFactory.class, CouchbaseCacheManager.class }) @ConditionalOnMissingBean(CacheManager.class) @ConditionalOnSingleCandidate(CouchbaseClientFactory.class) @Conditional(CacheCondition.class) -@Deprecated -public class CouchbaseCacheConfiguration { +class CouchbaseCacheConfiguration { @Bean - public CouchbaseCacheManager cacheManager(CacheProperties cacheProperties, CacheManagerCustomizers customizers, + CouchbaseCacheManager cacheManager(CacheProperties cacheProperties, CacheManagerCustomizers customizers, ObjectProvider couchbaseCacheManagerBuilderCustomizers, CouchbaseClientFactory clientFactory) { List cacheNames = cacheProperties.getCacheNames(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/CassandraProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/CassandraProperties.java index 6facba1a43..b21e5bd535 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/CassandraProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/CassandraProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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 java.util.List; import com.datastax.oss.driver.api.core.DefaultConsistencyLevel; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; /** * Configuration properties for Cassandra. @@ -126,17 +125,6 @@ public class CassandraProperties { this.sessionName = sessionName; } - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.data.cassandra.session-name") - public String getClusterName() { - return getSessionName(); - } - - @Deprecated - public void setClusterName(String clusterName) { - setSessionName(clusterName); - } - public List getContactPoints() { return this.contactPoints; } @@ -181,61 +169,6 @@ public class CassandraProperties { this.compression = compression; } - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.data.cassandra.request.consistency") - public DefaultConsistencyLevel getConsistencyLevel() { - return getRequest().getConsistency(); - } - - @Deprecated - public void setConsistencyLevel(DefaultConsistencyLevel consistency) { - getRequest().setConsistency(consistency); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.data.cassandra.request.serial-consistency") - public DefaultConsistencyLevel getSerialConsistencyLevel() { - return getRequest().getSerialConsistency(); - } - - @Deprecated - public void setSerialConsistencyLevel(DefaultConsistencyLevel serialConsistency) { - getRequest().setSerialConsistency(serialConsistency); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.data.cassandra.request.page-size") - public int getFetchSize() { - return getRequest().getPageSize(); - } - - @Deprecated - public void setFetchSize(int fetchSize) { - getRequest().setPageSize(fetchSize); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.data.cassandra.connection.init-query-timeout") - public Duration getConnectTimeout() { - return getConnection().getInitQueryTimeout(); - } - - @Deprecated - public void setConnectTimeout(Duration connectTimeout) { - getConnection().setInitQueryTimeout(connectTimeout); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.data.cassandra.request.timeout") - public Duration getReadTimeout() { - return getRequest().getTimeout(); - } - - @Deprecated - public void setReadTimeout(Duration readTimeout) { - getRequest().setTimeout(readTimeout); - } - public boolean isSsl() { return this.ssl; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/RestClientBuilderCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/RestClientBuilderCustomizer.java deleted file mode 100644 index f31e7309c2..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/RestClientBuilderCustomizer.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2012-2020 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.elasticsearch.rest; - -import org.elasticsearch.client.RestClientBuilder; - -/** - * Callback interface that can be implemented by beans wishing to further customize the - * {@link org.elasticsearch.client.RestClient} via a {@link RestClientBuilder} whilst - * retaining default auto-configuration. - * - * @author Brian Clozel - * @since 2.1.0 - * @deprecated as of 2.3.1 in favor of - * {@link org.springframework.boot.autoconfigure.elasticsearch.RestClientBuilderCustomizer} - */ -@FunctionalInterface -@Deprecated -public interface RestClientBuilderCustomizer - extends org.springframework.boot.autoconfigure.elasticsearch.RestClientBuilderCustomizer { - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/package-info.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/package-info.java deleted file mode 100644 index a57c5bc461..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2012-2020 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. - */ - -/** - * Deprecated auto-configuration for Elasticsearch client, superseded by classes in - * {@code org.springframework.boot.autoconfigure.elasticsearch}. - */ -package org.springframework.boot.autoconfigure.elasticsearch.rest; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java index 97f2794ad2..d0c31bfd4a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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,8 +21,6 @@ import java.util.List; import com.mongodb.client.MongoClient; import com.mongodb.client.MongoClients; -import org.springframework.core.env.Environment; - /** * A factory for a blocking {@link MongoClient}. * @@ -39,30 +37,6 @@ import org.springframework.core.env.Environment; */ public class MongoClientFactory extends MongoClientFactorySupport { - /** - * Construct a factory for creating a blocking {@link MongoClient}. - * @param properties configuration properties - * @param environment a Spring {@link Environment} containing configuration properties - * @deprecated since 2.3.0 in favor of {@link #MongoClientFactory(List)} - */ - @Deprecated - public MongoClientFactory(MongoProperties properties, Environment environment) { - this(null); - } - - /** - * Construct a factory for creating a blocking {@link MongoClient}. - * @param properties configuration properties - * @param environment a Spring {@link Environment} containing configuration properties - * @param builderCustomizers a list of configuration settings customizers - * @deprecated since 2.4.0 in favor of {@link #MongoClientFactory(List)} - */ - @Deprecated - public MongoClientFactory(MongoProperties properties, Environment environment, - List builderCustomizers) { - this(builderCustomizers); - } - /** * Construct a factory for creating a blocking {@link MongoClient}. * @param builderCustomizers a list of configuration settings customizers diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactorySupport.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactorySupport.java index 294740b536..be841adec8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactorySupport.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactorySupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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,8 +24,6 @@ import com.mongodb.MongoClientSettings; import com.mongodb.MongoClientSettings.Builder; import com.mongodb.MongoDriverInformation; -import org.springframework.core.env.Environment; - /** * Base class for setup that is common to MongoDB client factories. * @@ -40,13 +38,6 @@ public abstract class MongoClientFactorySupport { private final BiFunction clientCreator; - @Deprecated - protected MongoClientFactorySupport(MongoProperties properties, Environment environment, - List builderCustomizers, - BiFunction clientCreator) { - this(builderCustomizers, clientCreator); - } - protected MongoClientFactorySupport(List builderCustomizers, BiFunction clientCreator) { this.builderCustomizers = (builderCustomizers != null) ? builderCustomizers : Collections.emptyList(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java index 560579c75a..2a026db760 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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,8 +21,6 @@ import java.util.List; import com.mongodb.reactivestreams.client.MongoClient; import com.mongodb.reactivestreams.client.MongoClients; -import org.springframework.core.env.Environment; - /** * A factory for a reactive {@link MongoClient}. * @@ -33,19 +31,6 @@ import org.springframework.core.env.Environment; */ public class ReactiveMongoClientFactory extends MongoClientFactorySupport { - /** - * Construct a factory for creating a {@link MongoClient}. - * @param properties configuration properties - * @param environment a Spring {@link Environment} containing configuration properties - * @param builderCustomizers a list of configuration settings customizers - * @deprecated since 2.4.0 in favor of {@link #ReactiveMongoClientFactory(List)} - */ - @Deprecated - public ReactiveMongoClientFactory(MongoProperties properties, Environment environment, - List builderCustomizers) { - super(properties, environment, builderCustomizers, MongoClients::create); - } - /** * Construct a factory for creating a {@link MongoClient}. * @param builderCustomizers a list of configuration settings customizers diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyProperties.java index dc49c2dd65..dd7334c093 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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.List; import java.util.Map; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; import org.springframework.core.io.Resource; import org.springframework.security.saml2.provider.service.registration.Saml2MessageBinding; @@ -257,17 +256,6 @@ public class Saml2RelyingPartyProperties { this.metadataUri = metadataUri; } - @Deprecated - @DeprecatedConfigurationProperty(reason = "moved to 'singlesignon.url'") - public String getSsoUrl() { - return this.singlesignon.getUrl(); - } - - @Deprecated - public void setSsoUrl(String ssoUrl) { - this.singlesignon.setUrl(ssoUrl); - } - public Singlesignon getSinglesignon() { return this.singlesignon; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorProperties.java index 811c113cc6..11db4e7670 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -101,6 +101,28 @@ public class ErrorProperties { return this.whitelabel; } + /** + * Include Stacktrace attribute options. + */ + public enum IncludeStacktrace { + + /** + * Never add stacktrace information. + */ + NEVER, + + /** + * Always add stacktrace information. + */ + ALWAYS, + + /** + * Add error attribute when the appropriate request parameter is "true". + */ + ON_PARAM + + } + /** * Include error attributes options. */ diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java index 7de40d8a64..eb6f29d828 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -31,7 +31,6 @@ import java.util.Map; import io.undertow.UndertowOptions; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; import org.springframework.boot.context.properties.NestedConfigurationProperty; import org.springframework.boot.convert.DurationUnit; import org.springframework.boot.web.server.Compression; @@ -411,28 +410,6 @@ public class ServerProperties { */ private final Remoteip remoteip = new Remoteip(); - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.tomcat.threads.max") - public int getMaxThreads() { - return getThreads().getMax(); - } - - @Deprecated - public void setMaxThreads(int maxThreads) { - getThreads().setMax(maxThreads); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.tomcat.threads.min-spare") - public int getMinSpareThreads() { - return getThreads().getMinSpare(); - } - - @Deprecated - public void setMinSpareThreads(int minSpareThreads) { - getThreads().setMinSpare(minSpareThreads); - } - public DataSize getMaxHttpFormPostSize() { return this.maxHttpFormPostSize; } @@ -465,72 +442,6 @@ public class ServerProperties { this.basedir = basedir; } - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remoteip.internal-proxies") - @Deprecated - public String getInternalProxies() { - return this.remoteip.getInternalProxies(); - } - - @Deprecated - public void setInternalProxies(String internalProxies) { - this.remoteip.setInternalProxies(internalProxies); - } - - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remoteip.protocol-header") - @Deprecated - public String getProtocolHeader() { - return this.remoteip.getProtocolHeader(); - } - - @Deprecated - public void setProtocolHeader(String protocolHeader) { - this.remoteip.setProtocolHeader(protocolHeader); - } - - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remoteip.protocol-header-https-value") - @Deprecated - public String getProtocolHeaderHttpsValue() { - return this.remoteip.getProtocolHeaderHttpsValue(); - } - - @Deprecated - public void setProtocolHeaderHttpsValue(String protocolHeaderHttpsValue) { - this.remoteip.setProtocolHeaderHttpsValue(protocolHeaderHttpsValue); - } - - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remoteip.host-header") - @Deprecated - public String getHostHeader() { - return this.remoteip.getHostHeader(); - } - - @Deprecated - public void setHostHeader(String hostHeader) { - this.remoteip.setHostHeader(hostHeader); - } - - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remote.port-header") - @Deprecated - public String getPortHeader() { - return this.remoteip.getPortHeader(); - } - - @Deprecated - public void setPortHeader(String portHeader) { - this.remoteip.setPortHeader(portHeader); - } - - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remoteip.remote-ip-header") - @Deprecated - public String getRemoteIpHeader() { - return this.remoteip.getRemoteIpHeader(); - } - - @Deprecated - public void setRemoteIpHeader(String remoteIpHeader) { - this.remoteip.setRemoteIpHeader(remoteIpHeader); - } - public Boolean getRedirectContextRoot() { return this.redirectContextRoot; } @@ -539,11 +450,6 @@ public class ServerProperties { this.redirectContextRoot = redirectContextRoot; } - @Deprecated - public Boolean getUseRelativeRedirects() { - return this.useRelativeRedirects; - } - public boolean isUseRelativeRedirects() { return this.useRelativeRedirects; } @@ -552,11 +458,6 @@ public class ServerProperties { this.useRelativeRedirects = useRelativeRedirects; } - @Deprecated - public void setUseRelativeRedirects(Boolean useRelativeRedirects) { - this.useRelativeRedirects = (useRelativeRedirects != null) ? useRelativeRedirects : false; - } - public Charset getUriEncoding() { return this.uriEncoding; } @@ -1093,72 +994,6 @@ public class ServerProperties { this.maxHttpFormPostSize = maxHttpFormPostSize; } - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.jetty.threads.acceptors") - public Integer getAcceptors() { - return getThreads().getAcceptors(); - } - - @Deprecated - public void setAcceptors(Integer acceptors) { - getThreads().setAcceptors(acceptors); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.jetty.threads.selectors") - public Integer getSelectors() { - return getThreads().getSelectors(); - } - - @Deprecated - public void setSelectors(Integer selectors) { - getThreads().setSelectors(selectors); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.jetty.threads.min") - public Integer getMinThreads() { - return getThreads().getMin(); - } - - @Deprecated - public void setMinThreads(Integer minThreads) { - getThreads().setMin(minThreads); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.jetty.threads.max") - public Integer getMaxThreads() { - return getThreads().getMax(); - } - - @Deprecated - public void setMaxThreads(Integer maxThreads) { - getThreads().setMax(maxThreads); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.jetty.threads.max-queue-capacity") - public Integer getMaxQueueCapacity() { - return getThreads().getMaxQueueCapacity(); - } - - @Deprecated - public void setMaxQueueCapacity(Integer maxQueueCapacity) { - getThreads().setMaxQueueCapacity(maxQueueCapacity); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.jetty.threads.idle-timeout") - public Duration getThreadIdleTimeout() { - return getThreads().getIdleTimeout(); - } - - @Deprecated - public void setThreadIdleTimeout(Duration threadIdleTimeout) { - getThreads().setIdleTimeout(threadIdleTimeout); - } - public Duration getConnectionIdleTimeout() { return this.connectionIdleTimeout; } @@ -1579,28 +1414,6 @@ public class ServerProperties { this.bufferSize = bufferSize; } - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.undertow.threads.io") - public Integer getIoThreads() { - return getThreads().getIo(); - } - - @Deprecated - public void setIoThreads(Integer ioThreads) { - getThreads().setIo(ioThreads); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.undertow.threads.worker") - public Integer getWorkerThreads() { - return getThreads().getWorker(); - } - - @Deprecated - public void setWorkerThreads(Integer workerThreads) { - getThreads().setWorker(workerThreads); - } - public Boolean getDirectBuffers() { return this.directBuffers; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java index 2aa3c91dcf..82a229ca1e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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,18 +46,6 @@ public class WebConversionService extends DefaultFormattingConversionService { private static final boolean JSR_354_PRESENT = ClassUtils.isPresent("javax.money.MonetaryAmount", WebConversionService.class.getClassLoader()); - /** - * Create a new WebConversionService that configures formatters with the provided date - * format, or register the default ones if no custom format is provided. - * @param dateFormat the custom date format to use for date conversions - * @deprecated since 2.3.0 in favor of - * {@link #WebConversionService(DateTimeFormatters)} - */ - @Deprecated - public WebConversionService(String dateFormat) { - this(new DateTimeFormatters().dateFormat(dateFormat)); - } - /** * Create a new WebConversionService that configures formatters with the provided * date, time, and date-time formats, or registers the default if no custom format is diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxProperties.java index b4a991232b..db57808b5e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -17,7 +17,6 @@ package org.springframework.boot.autoconfigure.web.reactive; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; import org.springframework.util.StringUtils; /** @@ -62,17 +61,6 @@ public class WebFluxProperties { return candidate; } - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.webflux.format.date") - public String getDateFormat() { - return this.format.getDate(); - } - - @Deprecated - public void setDateFormat(String dateFormat) { - this.format.setDate(dateFormat); - } - public Format getFormat() { return this.format; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/AbstractErrorController.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/AbstractErrorController.java index edbce0d914..9e00a0944e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/AbstractErrorController.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/AbstractErrorController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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,7 +25,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.boot.web.error.ErrorAttributeOptions; -import org.springframework.boot.web.error.ErrorAttributeOptions.Include; import org.springframework.boot.web.servlet.error.ErrorAttributes; import org.springframework.boot.web.servlet.error.ErrorController; import org.springframework.core.annotation.AnnotationAwareOrderComparator; @@ -70,20 +69,6 @@ public abstract class AbstractErrorController implements ErrorController { return sorted; } - /** - * Returns a {@link Map} of the error attributes. - * @param request the source request - * @param includeStackTrace if stack trace elements should be included - * @return the error attributes - * @deprecated since 2.3.0 in favor of - * {@link #getErrorAttributes(HttpServletRequest, ErrorAttributeOptions)} - */ - @Deprecated - protected Map getErrorAttributes(HttpServletRequest request, boolean includeStackTrace) { - return getErrorAttributes(request, - (includeStackTrace) ? ErrorAttributeOptions.of(Include.STACK_TRACE) : ErrorAttributeOptions.defaults()); - } - protected Map getErrorAttributes(HttpServletRequest request, ErrorAttributeOptions options) { WebRequest webRequest = new ServletWebRequest(request); return this.errorAttributes.getErrorAttributes(webRequest, options); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java index e9bd4c30b0..d9d0bb052a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -81,12 +81,6 @@ public class BasicErrorController extends AbstractErrorController { this.errorProperties = errorProperties; } - @Override - @Deprecated - public String getErrorPath() { - return null; - } - @RequestMapping(produces = MediaType.TEXT_HTML_VALUE) public ModelAndView errorHtml(HttpServletRequest request, HttpServletResponse response) { HttpStatus status = getStatus(request); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchRestClientAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchRestClientAutoConfigurationTests.java index 3ed962ad38..47110d7f4c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchRestClientAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchRestClientAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -107,16 +107,6 @@ class ElasticsearchRestClientAutoConfigurationTests { }); } - @Test - @Deprecated - void configureWhenDeprecatedBuilderCustomizerShouldApply() { - this.contextRunner.withUserConfiguration(DeprecatedBuilderCustomizerConfiguration.class).run((context) -> { - assertThat(context).hasSingleBean(RestHighLevelClient.class); - RestHighLevelClient restClient = context.getBean(RestHighLevelClient.class); - assertThat(restClient.getLowLevelClient()).hasFieldOrPropertyWithValue("pathPrefix", "/deprecated"); - }); - } - @Test void configureWithNoTimeoutsApplyDefaults() { this.contextRunner.run((context) -> { @@ -296,17 +286,6 @@ class ElasticsearchRestClientAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - @Deprecated - static class DeprecatedBuilderCustomizerConfiguration { - - @Bean - org.springframework.boot.autoconfigure.elasticsearch.rest.RestClientBuilderCustomizer myCustomizer() { - return (builder) -> builder.setPathPrefix("/deprecated"); - } - - } - @Configuration(proxyBeanMethods = false) static class CustomRestHighLevelClientConfiguration { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyPropertiesTests.java index 7018e733bd..df3a02ace7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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,16 +39,6 @@ class Saml2RelyingPartyPropertiesTests { private final Saml2RelyingPartyProperties properties = new Saml2RelyingPartyProperties(); - @Deprecated - @Test - void customizeSsoUrlDeprecated() { - bind("spring.security.saml2.relyingparty.registration.simplesamlphp.identity-provider.sso-url", - "https://simplesaml-for-spring-saml/SSOService.php"); - assertThat( - this.properties.getRegistration().get("simplesamlphp").getIdentityprovider().getSinglesignon().getUrl()) - .isEqualTo("https://simplesaml-for-spring-saml/SSOService.php"); - } - @Test void customizeSsoUrl() { bind("spring.security.saml2.relyingparty.registration.simplesamlphp.identity-provider.single-sign-on.url", diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index 6d4414523a..64477313bf 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -216,105 +216,48 @@ class ServerPropertiesTests { assertThat(this.properties.getTomcat().getThreads().getMax()).isEqualTo(10); } - @Deprecated - @Test - void testCustomizeTomcatMaxThreadsDeprecated() { - bind("server.tomcat.maxThreads", "10"); - assertThat(this.properties.getTomcat().getThreads().getMax()).isEqualTo(10); - } - @Test void testCustomizeTomcatMinSpareThreads() { bind("server.tomcat.threads.min-spare", "10"); assertThat(this.properties.getTomcat().getThreads().getMinSpare()).isEqualTo(10); } - @Deprecated - @Test - void testCustomizeTomcatMinSpareThreadsDeprecated() { - bind("server.tomcat.min-spare-threads", "10"); - assertThat(this.properties.getTomcat().getThreads().getMinSpare()).isEqualTo(10); - } - @Test void testCustomizeJettyAcceptors() { bind("server.jetty.threads.acceptors", "10"); assertThat(this.properties.getJetty().getThreads().getAcceptors()).isEqualTo(10); } - @Deprecated - @Test - void testCustomizeJettyAcceptorsDeprecated() { - bind("server.jetty.acceptors", "10"); - assertThat(this.properties.getJetty().getThreads().getAcceptors()).isEqualTo(10); - } - @Test void testCustomizeJettySelectors() { bind("server.jetty.threads.selectors", "10"); assertThat(this.properties.getJetty().getThreads().getSelectors()).isEqualTo(10); } - @Deprecated - @Test - void testCustomizeJettySelectorsDeprecated() { - bind("server.jetty.selectors", "10"); - assertThat(this.properties.getJetty().getSelectors()).isEqualTo(10); - assertThat(this.properties.getJetty().getThreads().getSelectors()).isEqualTo(10); - } - @Test void testCustomizeJettyMaxThreads() { bind("server.jetty.threads.max", "10"); assertThat(this.properties.getJetty().getThreads().getMax()).isEqualTo(10); } - @Deprecated - @Test - void testCustomizeJettyMaxThreadsDeprecated() { - bind("server.jetty.maxThreads", "10"); - assertThat(this.properties.getJetty().getThreads().getMax()).isEqualTo(10); - } - @Test void testCustomizeJettyMinThreads() { bind("server.jetty.threads.min", "10"); assertThat(this.properties.getJetty().getThreads().getMin()).isEqualTo(10); } - @Deprecated - @Test - void testCustomizeJettyMinThreadsDeprecated() { - bind("server.jetty.minThreads", "10"); - assertThat(this.properties.getJetty().getThreads().getMin()).isEqualTo(10); - } - @Test void testCustomizeJettyIdleTimeout() { bind("server.jetty.threads.idle-timeout", "10s"); assertThat(this.properties.getJetty().getThreads().getIdleTimeout()).isEqualTo(Duration.ofSeconds(10)); } - @Deprecated - @Test - void testCustomizeJettyIdleTimeoutDeprecated() { - bind("server.jetty.thread-idle-timeout", "10s"); - assertThat(this.properties.getJetty().getThreads().getIdleTimeout()).hasSeconds(10); - } - @Test void testCustomizeJettyMaxQueueCapacity() { bind("server.jetty.threads.max-queue-capacity", "5150"); assertThat(this.properties.getJetty().getThreads().getMaxQueueCapacity()).isEqualTo(5150); } - @Deprecated - @Test - void testCustomizeJettyMaxQueueCapacityDeprecated() { - bind("server.jetty.max-queue-capacity", "5150"); - assertThat(this.properties.getJetty().getThreads().getMaxQueueCapacity()).isEqualTo(5150); - } - @Test void testCustomizeUndertowServerOption() { bind("server.undertow.options.server.ALWAYS_SET_KEEP_ALIVE", "true"); @@ -335,26 +278,12 @@ class ServerPropertiesTests { assertThat(this.properties.getUndertow().getThreads().getIo()).isEqualTo(4); } - @Deprecated - @Test - void testCustomizeUndertowIoThreadsDeprecated() { - bind("server.undertow.ioThreads", "4"); - assertThat(this.properties.getUndertow().getThreads().getIo()).isEqualTo(4); - } - @Test void testCustomizeUndertowWorkerThreads() { bind("server.undertow.threads.worker", "10"); assertThat(this.properties.getUndertow().getThreads().getWorker()).isEqualTo(10); } - @Deprecated - @Test - void testCustomizeUndertowWorkerThreadsDeprecated() { - bind("server.undertow.workerThreads", "10"); - assertThat(this.properties.getUndertow().getThreads().getWorker()).isEqualTo(10); - } - @Test void testCustomizeJettyAccessLog() { Map map = new HashMap<>(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java index f038700526..04330276d6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -164,7 +164,7 @@ class JettyWebServerFactoryCustomizerTests { @Test void threadPoolMaxThreadsCanBeCustomized() { - bind("server.jetty.max-threads=100"); + bind("server.jetty.threads.max=100"); JettyWebServer server = customizeAndGetServer(); QueuedThreadPool threadPool = (QueuedThreadPool) server.getServer().getThreadPool(); assertThat(threadPool.getMaxThreads()).isEqualTo(100); @@ -172,7 +172,7 @@ class JettyWebServerFactoryCustomizerTests { @Test void threadPoolMinThreadsCanBeCustomized() { - bind("server.jetty.min-threads=100"); + bind("server.jetty.threads.min=100"); JettyWebServer server = customizeAndGetServer(); QueuedThreadPool threadPool = (QueuedThreadPool) server.getServer().getThreadPool(); assertThat(threadPool.getMinThreads()).isEqualTo(100); @@ -198,8 +198,8 @@ class JettyWebServerFactoryCustomizerTests { @Test void threadPoolWithMaxQueueCapacityEqualToZeroCustomizesThreadPool() { - bind("server.jetty.threads.max-queue-capacity=0", "server.jetty.min-threads=100", - "server.jetty.max-threads=100", "server.jetty.threads.idle-timeout=6s"); + bind("server.jetty.threads.max-queue-capacity=0", "server.jetty.threads.min=100", + "server.jetty.threads.max=100", "server.jetty.threads.idle-timeout=6s"); JettyWebServer server = customizeAndGetServer(); QueuedThreadPool threadPool = (QueuedThreadPool) server.getServer().getThreadPool(); assertThat(threadPool.getMinThreads()).isEqualTo(100); @@ -220,8 +220,8 @@ class JettyWebServerFactoryCustomizerTests { @Test void threadPoolWithMaxQueueCapacityPositiveCustomizesThreadPool() { - bind("server.jetty.threads.max-queue-capacity=1234", "server.jetty.min-threads=10", - "server.jetty.max-threads=150", "server.jetty.threads.idle-timeout=3s"); + bind("server.jetty.threads.max-queue-capacity=1234", "server.jetty.threads.min=10", + "server.jetty.threads.max=150", "server.jetty.threads.idle-timeout=3s"); JettyWebServer server = customizeAndGetServer(); QueuedThreadPool threadPool = (QueuedThreadPool) server.getServer().getThreadPool(); assertThat(threadPool.getMinThreads()).isEqualTo(10); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java index 74d8518cd3..4b6416b0a6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -186,26 +186,6 @@ class TomcatWebServerFactoryCustomizerTests { assertThat(remoteIpValve.getInternalProxies()).isEqualTo("192.168.0.1"); } - @Test - @Deprecated - void customRemoteIpValveWithDeprecatedProperties() { - bind("server.tomcat.remote-ip-header=x-my-remote-ip-header", - "server.tomcat.protocol-header=x-my-protocol-header", "server.tomcat.internal-proxies=192.168.0.1", - "server.tomcat.host-header=x-my-forward-host", "server.tomcat.port-header=x-my-forward-port", - "server.tomcat.protocol-header-https-value=On"); - TomcatServletWebServerFactory factory = customizeAndGetFactory(); - assertThat(factory.getEngineValves()).hasSize(1); - Valve valve = factory.getEngineValves().iterator().next(); - assertThat(valve).isInstanceOf(RemoteIpValve.class); - RemoteIpValve remoteIpValve = (RemoteIpValve) valve; - assertThat(remoteIpValve.getProtocolHeader()).isEqualTo("x-my-protocol-header"); - assertThat(remoteIpValve.getProtocolHeaderHttpsValue()).isEqualTo("On"); - assertThat(remoteIpValve.getRemoteIpHeader()).isEqualTo("x-my-remote-ip-header"); - assertThat(remoteIpValve.getHostHeader()).isEqualTo("x-my-forward-host"); - assertThat(remoteIpValve.getPortHeader()).isEqualTo("x-my-forward-port"); - assertThat(remoteIpValve.getInternalProxies()).isEqualTo("192.168.0.1"); - } - @Test void customStaticResourceAllowCaching() { bind("server.tomcat.resource.allow-caching=false"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java index 421fed5cb4..c105b0f328 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -212,15 +212,6 @@ class WebFluxAutoConfigurationTests { }); } - @Test - void customDateFormatWithDeprecatedProperty() { - this.contextRunner.withPropertyValues("spring.webflux.date-format:dd*MM*yyyy").run((context) -> { - FormattingConversionService conversionService = context.getBean(FormattingConversionService.class); - Date date = Date.from(ZonedDateTime.of(1988, 6, 25, 20, 30, 0, 0, ZoneId.systemDefault()).toInstant()); - assertThat(conversionService.convert(date, String.class)).isEqualTo("25*06*1988"); - }); - } - @Test void customDateFormat() { this.contextRunner.withPropertyValues("spring.webflux.format.date:dd*MM*yyyy").run((context) -> { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTests.java index 97a8ca73b4..08cab75a09 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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,6 +36,7 @@ import org.springframework.boot.test.context.assertj.AssertableReactiveWebApplic import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner; import org.springframework.boot.test.system.CapturedOutput; import org.springframework.boot.test.system.OutputCaptureExtension; +import org.springframework.boot.web.error.ErrorAttributeOptions; import org.springframework.boot.web.reactive.error.DefaultErrorAttributes; import org.springframework.boot.web.reactive.error.ErrorAttributes; import org.springframework.context.annotation.Bean; @@ -337,7 +338,7 @@ class DefaultErrorWebExceptionHandlerIntegrationTests { } @Test - void defaultErrorAttributesSubclassUsingDeprecatedApiAndDelegation() { + void defaultErrorAttributesSubclassUsingDelegation() { this.contextRunner.withUserConfiguration(CustomErrorAttributesWithDelegation.class).run((context) -> { WebTestClient client = getWebClient(context); client.get().uri("/badRequest").exchange().expectStatus().isBadRequest().expectBody().jsonPath("status") @@ -347,7 +348,7 @@ class DefaultErrorWebExceptionHandlerIntegrationTests { } @Test - void defaultErrorAttributesSubclassUsingDeprecatedApiWithoutDelegation() { + void defaultErrorAttributesSubclassWithoutDelegation() { this.contextRunner.withUserConfiguration(CustomErrorAttributesWithoutDelegation.class).run((context) -> { WebTestClient client = getWebClient(context); client.get().uri("/badRequest").exchange().expectStatus().isBadRequest().expectBody().jsonPath("status") @@ -425,9 +426,8 @@ class DefaultErrorWebExceptionHandlerIntegrationTests { ErrorAttributes errorAttributes() { return new DefaultErrorAttributes() { @Override - @SuppressWarnings("deprecation") - public Map getErrorAttributes(ServerRequest request, boolean includeStackTrace) { - Map errorAttributes = super.getErrorAttributes(request, includeStackTrace); + public Map getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) { + Map errorAttributes = super.getErrorAttributes(request, options); errorAttributes.put("error", "custom error"); errorAttributes.put("newAttribute", "value"); errorAttributes.remove("path"); @@ -446,8 +446,7 @@ class DefaultErrorWebExceptionHandlerIntegrationTests { ErrorAttributes errorAttributes() { return new DefaultErrorAttributes() { @Override - @SuppressWarnings("deprecation") - public Map getErrorAttributes(ServerRequest request, boolean includeStackTrace) { + public Map getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) { Map errorAttributes = new HashMap<>(); errorAttributes.put("status", 400); errorAttributes.put("error", "custom error"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchive.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchive.java index a03c2f0b0e..126f2a0cc5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchive.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchive.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -128,26 +128,4 @@ public interface BootArchive extends Task { */ void setClasspath(FileCollection classpath); - /** - * Returns {@code true} if the Devtools jar should be excluded, otherwise - * {@code false}. - * @return {@code true} if the Devtools jar should be excluded, or {@code false} if - * not - * @deprecated since 2.3.0 in favour of configuring a classpath that does not include - * development-only dependencies - */ - @Input - @Deprecated - boolean isExcludeDevtools(); - - /** - * Sets whether or not the Devtools jar should be excluded. - * @param excludeDevtools {@code true} if the Devtools jar should be excluded, or - * {@code false} if not - * @deprecated since 2.3.0 in favour of configuring a classpath that does not include - * development-only dependencies - */ - @Deprecated - void setExcludeDevtools(boolean excludeDevtools); - } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java index d316188040..debc5b5c8f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -76,15 +76,12 @@ class BootArchiveSupport { private LaunchScriptConfiguration launchScript; - private boolean excludeDevtools = false; - BootArchiveSupport(String loaderMainClass, Spec librarySpec, Function compressionResolver) { this.loaderMainClass = loaderMainClass; this.librarySpec = librarySpec; this.compressionResolver = compressionResolver; this.requiresUnpack.include(Specs.satisfyNone()); - configureExclusions(); } void configureManifest(Manifest manifest, String mainClass, String classes, String lib, String classPathIndex, @@ -149,15 +146,6 @@ class BootArchiveSupport { this.requiresUnpack.include(spec); } - boolean isExcludeDevtools() { - return this.excludeDevtools; - } - - void setExcludeDevtools(boolean excludeDevtools) { - this.excludeDevtools = excludeDevtools; - configureExclusions(); - } - void excludeNonZipLibraryFiles(FileCopyDetails details) { if (this.librarySpec.isSatisfiedBy(details)) { excludeNonZipFiles(details); @@ -190,14 +178,6 @@ class BootArchiveSupport { return true; } - private void configureExclusions() { - Set excludes = new HashSet<>(); - if (this.excludeDevtools) { - excludes.add("**/spring-boot-devtools-*.jar"); - } - this.exclusions.setExcludes(excludes); - } - void moveModuleInfoToRoot(CopySpec spec) { spec.filesMatching("module-info.class", BootArchiveSupport::moveToRoot); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java index a853e245ba..adf3a0968e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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,8 +22,6 @@ import java.util.concurrent.Callable; import java.util.function.Function; import org.gradle.api.Action; -import org.gradle.api.Project; -import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.ResolvableDependencies; import org.gradle.api.file.CopySpec; import org.gradle.api.file.FileCollection; @@ -128,18 +126,6 @@ public class BootJar extends Jar implements BootArchive { return this.support.createCopyAction(this); } - /** - * Returns the {@link Configuration Configurations} of the project associated with - * this task. - * @return the configurations - * @deprecated since 2.3.5 in favor of {@link Project#getConfigurations} - */ - @Internal - @Deprecated - protected Iterable getConfigurations() { - return getProject().getConfigurations(); - } - @Override public Property getMainClass() { return this.mainClass; @@ -232,18 +218,6 @@ public class BootJar extends Jar implements BootArchive { this.classpath = getProject().files(classpath); } - @Override - @Deprecated - public boolean isExcludeDevtools() { - return this.support.isExcludeDevtools(); - } - - @Override - @Deprecated - public void setExcludeDevtools(boolean excludeDevtools) { - this.support.setExcludeDevtools(excludeDevtools); - } - /** * Returns a {@code CopySpec} that can be used to add content to the {@code BOOT-INF} * directory of the jar. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java index 2e23560ada..ddeac3b6f1 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -169,18 +169,6 @@ public class BootWar extends War implements BootArchive { this.providedClasspath = getProject().files(classpath); } - @Override - @Deprecated - public boolean isExcludeDevtools() { - return this.support.isExcludeDevtools(); - } - - @Override - @Deprecated - public void setExcludeDevtools(boolean excludeDevtools) { - this.support.setExcludeDevtools(excludeDevtools); - } - /** * Return the {@link ZipCompression} that should be used when adding the file * represented by the given {@code details} to the jar. By default, any diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java index 965a66b6c1..6582953e56 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -369,19 +369,6 @@ abstract class AbstractBootArchiveTests { } } - @Test - @Deprecated - void devtoolsJarCanBeIncluded() throws IOException { - this.task.getMainClass().set("com.example.Main"); - this.task.classpath(jarFile("spring-boot-devtools-0.1.2.jar")); - this.task.setExcludeDevtools(false); - executeTask(); - assertThat(this.task.getArchiveFile().get().getAsFile()).exists(); - try (JarFile jarFile = new JarFile(this.task.getArchiveFile().get().getAsFile())) { - assertThat(jarFile.getEntry(this.libPath + "spring-boot-devtools-0.1.2.jar")).isNotNull(); - } - } - @Test void allEntriesUseUnixPlatformAndUtf8NameEncoding() throws IOException { this.task.getMainClass().set("com.example.Main"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java index 1b234633e7..23cdeaec66 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -80,18 +80,6 @@ class BootWarTests extends AbstractBootArchiveTests { } } - @Test - @Deprecated - void devtoolsJarCanBeIncludedWhenItsOnTheProvidedClasspath() throws IOException { - getTask().getMainClass().set("com.example.Main"); - getTask().providedClasspath(jarFile("spring-boot-devtools-0.1.2.jar")); - getTask().setExcludeDevtools(false); - executeTask(); - try (JarFile jarFile = new JarFile(getTask().getArchiveFile().get().getAsFile())) { - assertThat(jarFile.getEntry("WEB-INF/lib-provided/spring-boot-devtools-0.1.2.jar")).isNotNull(); - } - } - @Test void webappResourcesInDirectoriesThatOverlapWithLoaderCanBePackaged() throws IOException { File webappDirectory = new File(this.temp, "src/main/webapp"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layout.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layout.java index 0634f8dff3..8ab82269e5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layout.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layout.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -42,20 +42,7 @@ public interface Layout { * @return the location of the library relative to the root of the archive (should end * with '/') or {@code null} if the library should not be included. */ - default String getLibraryLocation(String libraryName, LibraryScope scope) { - return getLibraryDestination(libraryName, scope); - } - - /** - * Returns the destination path for a given library. - * @param libraryName the name of the library (excluding any path) - * @param scope the scope of the library - * @return the destination relative to the root of the archive (should end with '/') - * or {@code null} if the library should not be included. - * @deprecated since 2.3.0 in favor of {@link #getLibraryLocation} - */ - @Deprecated - String getLibraryDestination(String libraryName, LibraryScope scope); + String getLibraryLocation(String libraryName, LibraryScope scope); /** * Returns the location of classes within the archive. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java index 02b1c3729b..2dc5af0c86 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -73,12 +73,6 @@ public final class Layouts { return "BOOT-INF/lib/"; } - @Deprecated - @Override - public String getLibraryDestination(String libraryName, LibraryScope scope) { - return "BOOT-INF/lib/"; - } - @Override public String getClassesLocation() { return ""; @@ -161,12 +155,6 @@ public final class Layouts { return SCOPE_LOCATION.get(scope); } - @Deprecated - @Override - public String getLibraryDestination(String libraryName, LibraryScope scope) { - return SCOPE_LOCATION.get(scope); - } - @Override public String getClassesLocation() { return "WEB-INF/classes/"; 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 2c1833be15..83ec65ed16 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 @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -175,16 +175,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { @Parameter(property = "spring-boot.run.main-class") private String mainClass; - /** - * Additional directories besides the classes directory that should be added to the - * classpath. - * @since 1.0.0 - * @deprecated since 2.3.0 in favor of {@code directories} - */ - @Deprecated - @Parameter(property = "spring-boot.run.folders") - private String[] folders; - /** * Additional directories besides the classes directory that should be added to the * classpath. @@ -462,11 +452,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { } private void addUserDefinedDirectories(List urls) throws MalformedURLException { - if (this.folders != null) { - for (String folder : this.folders) { - urls.add(new File(folder).toURI().toURL()); - } - } if (this.directories != null) { for (String directory : this.directories) { urls.add(new File(directory).toURI().toURL()); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index b8424d29d6..9d6bb30bb5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -423,7 +423,7 @@ public class SpringApplication { // Not allowed in some environments. } } - refresh((ApplicationContext) context); + refresh(context); } private void configureHeadlessProperty() { @@ -747,18 +747,6 @@ public class SpringApplication { return new BeanDefinitionLoader(registry, sources); } - /** - * Refresh the underlying {@link ApplicationContext}. - * @param applicationContext the application context to refresh - * @deprecated since 2.3.0 in favor of - * {@link #refresh(ConfigurableApplicationContext)} - */ - @Deprecated - protected void refresh(ApplicationContext applicationContext) { - Assert.isInstanceOf(ConfigurableApplicationContext.class, applicationContext); - refresh((ConfigurableApplicationContext) applicationContext); - } - /** * Refresh the underlying {@link ApplicationContext}. * @param applicationContext the application context to refresh diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java index 4c8c511f90..dca13a3eb3 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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 io.undertow.Undertow.Builder; import io.undertow.server.HttpHandler; import io.undertow.servlet.api.DeploymentManager; -import org.springframework.boot.web.server.Compression; import org.springframework.boot.web.server.WebServer; import org.springframework.util.StringUtils; @@ -44,58 +43,6 @@ public class UndertowServletWebServer extends UndertowWebServer { private final DeploymentManager manager; - /** - * Create a new {@link UndertowServletWebServer} instance. - * @param builder the builder - * @param manager the deployment manager - * @param contextPath the root context path - * @param autoStart if the server should be started - * @param compression compression configuration - * @deprecated since 2.3.0 in favor of - * {@link #UndertowServletWebServer(io.undertow.Undertow.Builder, Iterable, String, boolean)} - */ - @Deprecated - public UndertowServletWebServer(Builder builder, DeploymentManager manager, String contextPath, boolean autoStart, - Compression compression) { - this(builder, manager, contextPath, false, autoStart, compression); - } - - /** - * Create a new {@link UndertowServletWebServer} instance. - * @param builder the builder - * @param manager the deployment manager - * @param contextPath the root context path - * @param useForwardHeaders if x-forward headers should be used - * @param autoStart if the server should be started - * @param compression compression configuration - * @deprecated since 2.3.0 in favor of - * {@link #UndertowServletWebServer(io.undertow.Undertow.Builder, Iterable, String, boolean)} - */ - @Deprecated - public UndertowServletWebServer(Builder builder, DeploymentManager manager, String contextPath, - boolean useForwardHeaders, boolean autoStart, Compression compression) { - this(builder, manager, contextPath, useForwardHeaders, autoStart, compression, null); - } - - /** - * Create a new {@link UndertowServletWebServer} instance. - * @param builder the builder - * @param manager the deployment manager - * @param contextPath the root context path - * @param useForwardHeaders if x-forward headers should be used - * @param autoStart if the server should be started - * @param compression compression configuration - * @param serverHeader string to be used in HTTP header - * @deprecated since 2.3.0 in favor of - * {@link #UndertowServletWebServer(io.undertow.Undertow.Builder, Iterable, String, boolean)} - */ - @Deprecated - public UndertowServletWebServer(Builder builder, DeploymentManager manager, String contextPath, - boolean useForwardHeaders, boolean autoStart, Compression compression, String serverHeader) { - this(builder, UndertowWebServerFactoryDelegate.createHttpHandlerFactories(compression, useForwardHeaders, - serverHeader, null, new DeploymentManagerHttpHandlerFactory(manager)), contextPath, autoStart); - } - /** * Create a new {@link UndertowServletWebServer} instance. * @param builder the builder diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java index 5278bf6920..f1e8c28adb 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java @@ -83,21 +83,7 @@ public class UndertowWebServer implements WebServer { * @param autoStart if the server should be started */ public UndertowWebServer(Undertow.Builder builder, boolean autoStart) { - this(builder, autoStart, null); - } - - /** - * Create a new {@link UndertowWebServer} instance. - * @param builder the builder - * @param autoStart if the server should be started - * @param closeable called when the server is stopped - * @since 2.0.4 - * @deprecated since 2.3.0 in favor of - * {@link #UndertowWebServer(io.undertow.Undertow.Builder, Iterable, boolean)} - */ - @Deprecated - public UndertowWebServer(Undertow.Builder builder, boolean autoStart, Closeable closeable) { - this(builder, Collections.singleton(new CloseableHttpHandlerFactory(closeable)), autoStart); + this(builder, Collections.singleton(new CloseableHttpHandlerFactory(null)), autoStart); } /** diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java index 6210c5ce8c..c96b4376e5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -63,32 +63,9 @@ public class DefaultErrorAttributes implements ErrorAttributes { private static final String ERROR_ATTRIBUTE = DefaultErrorAttributes.class.getName() + ".ERROR"; - private final Boolean includeException; - - /** - * Create a new {@link DefaultErrorAttributes} instance. - */ - public DefaultErrorAttributes() { - this.includeException = null; - } - - /** - * Create a new {@link DefaultErrorAttributes} instance. - * @param includeException whether to include the "exception" attribute - * @deprecated since 2.3.0 in favor of - * {@link ErrorAttributeOptions#including(Include...)} - */ - @Deprecated - public DefaultErrorAttributes(boolean includeException) { - this.includeException = includeException; - } - @Override public Map getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) { Map errorAttributes = getErrorAttributes(request, options.isIncluded(Include.STACK_TRACE)); - if (Boolean.TRUE.equals(this.includeException)) { - options = options.including(Include.EXCEPTION); - } if (!options.isIncluded(Include.EXCEPTION)) { errorAttributes.remove("exception"); } @@ -104,9 +81,7 @@ public class DefaultErrorAttributes implements ErrorAttributes { return errorAttributes; } - @Override - @Deprecated - public Map getErrorAttributes(ServerRequest request, boolean includeStackTrace) { + private Map getErrorAttributes(ServerRequest request, boolean includeStackTrace) { Map errorAttributes = new LinkedHashMap<>(); errorAttributes.put("timestamp", new Date()); errorAttributes.put("path", request.path()); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/ErrorAttributes.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/ErrorAttributes.java index c1cd5d707e..73b10af548 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/ErrorAttributes.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/ErrorAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -20,7 +20,6 @@ import java.util.Collections; import java.util.Map; import org.springframework.boot.web.error.ErrorAttributeOptions; -import org.springframework.boot.web.error.ErrorAttributeOptions.Include; import org.springframework.web.reactive.function.server.ServerRequest; import org.springframework.web.reactive.function.server.ServerResponse; import org.springframework.web.server.ServerWebExchange; @@ -35,20 +34,6 @@ import org.springframework.web.server.ServerWebExchange; */ public interface ErrorAttributes { - /** - * Return a {@link Map} of the error attributes. The map can be used as the model of - * an error page, or returned as a {@link ServerResponse} body. - * @param request the source request - * @param includeStackTrace if stack trace attribute should be included - * @return a map of error attributes - * @deprecated since 2.3.0 in favor of - * {@link #getErrorAttributes(ServerRequest, ErrorAttributeOptions)} - */ - @Deprecated - default Map getErrorAttributes(ServerRequest request, boolean includeStackTrace) { - return Collections.emptyMap(); - } - /** * Return a {@link Map} of the error attributes. The map can be used as the model of * an error page, or returned as a {@link ServerResponse} body. @@ -57,7 +42,7 @@ public interface ErrorAttributes { * @return a map of error attributes */ default Map getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) { - return getErrorAttributes(request, options.isIncluded(Include.STACK_TRACE)); + return Collections.emptyMap(); } /** diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributes.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributes.java index e6c5d12242..a14f599af3 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributes.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -70,26 +70,6 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException private static final String ERROR_ATTRIBUTE = DefaultErrorAttributes.class.getName() + ".ERROR"; - private final Boolean includeException; - - /** - * Create a new {@link DefaultErrorAttributes} instance. - */ - public DefaultErrorAttributes() { - this.includeException = null; - } - - /** - * Create a new {@link DefaultErrorAttributes} instance. - * @param includeException whether to include the "exception" attribute - * @deprecated since 2.3.0 in favor of - * {@link ErrorAttributeOptions#including(Include...)} - */ - @Deprecated - public DefaultErrorAttributes(boolean includeException) { - this.includeException = includeException; - } - @Override public int getOrder() { return Ordered.HIGHEST_PRECEDENCE; @@ -109,9 +89,6 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException @Override public Map getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) { Map errorAttributes = getErrorAttributes(webRequest, options.isIncluded(Include.STACK_TRACE)); - if (Boolean.TRUE.equals(this.includeException)) { - options = options.including(Include.EXCEPTION); - } if (!options.isIncluded(Include.EXCEPTION)) { errorAttributes.remove("exception"); } @@ -127,9 +104,7 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException return errorAttributes; } - @Override - @Deprecated - public Map getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { + private Map getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { Map errorAttributes = new LinkedHashMap<>(); errorAttributes.put("timestamp", new Date()); addStatus(errorAttributes, webRequest); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorAttributes.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorAttributes.java index f3ae6e38c8..911fc545c1 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorAttributes.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -20,7 +20,6 @@ import java.util.Collections; import java.util.Map; import org.springframework.boot.web.error.ErrorAttributeOptions; -import org.springframework.boot.web.error.ErrorAttributeOptions.Include; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.ModelAndView; @@ -35,21 +34,6 @@ import org.springframework.web.servlet.ModelAndView; */ public interface ErrorAttributes { - /** - * Returns a {@link Map} of the error attributes. The map can be used as the model of - * an error page {@link ModelAndView}, or returned as a - * {@link ResponseBody @ResponseBody}. - * @param webRequest the source request - * @param includeStackTrace if stack trace element should be included - * @return a map of error attributes - * @deprecated since 2.3.0 in favor of - * {@link #getErrorAttributes(WebRequest, ErrorAttributeOptions)} - */ - @Deprecated - default Map getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { - return Collections.emptyMap(); - } - /** * Returns a {@link Map} of the error attributes. The map can be used as the model of * an error page {@link ModelAndView}, or returned as a @@ -60,7 +44,7 @@ public interface ErrorAttributes { * @since 2.3.0 */ default Map getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) { - return getErrorAttributes(webRequest, options.isIncluded(Include.STACK_TRACE)); + return Collections.emptyMap(); } /** diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorController.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorController.java index 225e345d2e..dc899fa9ae 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorController.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -26,16 +26,6 @@ import org.springframework.stereotype.Controller; * @author Scott Frederick * @since 2.0.0 */ -@FunctionalInterface public interface ErrorController { - /** - * The return value from this method is not used; the property `server.error.path` - * must be set to override the default error page path. - * @return the error path - * @deprecated since 2.3.0 in favor of setting the property `server.error.path` - */ - @Deprecated - String getErrorPath(); - } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributesTests.java index ad0c061cc2..32e2214362 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -164,19 +164,6 @@ class DefaultErrorAttributesTests { assertThat(attributes.get("message")).isEqualTo("Test"); } - @Test - @SuppressWarnings("deprecation") - void excludeExceptionWithDeprecatedConstructor() { - RuntimeException error = new RuntimeException("Test"); - this.errorAttributes = new DefaultErrorAttributes(false); - MockServerHttpRequest request = MockServerHttpRequest.get("/test").build(); - ServerRequest serverRequest = buildServerRequest(request, error); - Map attributes = this.errorAttributes.getErrorAttributes(serverRequest, - ErrorAttributeOptions.of()); - assertThat(this.errorAttributes.getError(serverRequest)).isSameAs(error); - assertThat(attributes.get("exception")).isNull(); - } - @Test void processResponseStatusException() { RuntimeException nested = new RuntimeException("Test"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributesTests.java index fd5336bab8..6a882e9b0f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -231,17 +231,6 @@ class DefaultErrorAttributesTests { assertThat(attributes.get("message")).isEqualTo("Test"); } - @Test - @SuppressWarnings("deprecation") - void excludeExceptionAttributeWithDeprecatedConstructor() { - DefaultErrorAttributes errorAttributes = new DefaultErrorAttributes(false); - RuntimeException ex = new RuntimeException("Test"); - this.request.setAttribute("javax.servlet.error.exception", ex); - Map attributes = errorAttributes.getErrorAttributes(this.webRequest, - ErrorAttributeOptions.of()); - assertThat(attributes.get("exception")).isNull(); - } - @Test void withStackTraceAttribute() { RuntimeException ex = new RuntimeException("Test");