Merge pull request #36251 from bbulgarelli

* pr/36251:
  Polish contribution
  Deprecate DelegatingApplicationContextInitializer and DelegatingApplicationListener

Closes gh-36251
This commit is contained in:
Stephane Nicoll 2023-07-17 13:43:28 +02:00
commit 3995883821
5 changed files with 12 additions and 3 deletions

View File

@ -61,7 +61,6 @@ Spring Boot loads a number of such customizations for use internally from `META-
There is more than one way to register additional customizations:
* Programmatically, per application, by calling the `addListeners` and `addInitializers` methods on `SpringApplication` before you run it.
* Declaratively, per application, by setting the `context.initializer.classes` or `context.listener.classes` properties.
* Declaratively, for all applications, by adding a `META-INF/spring.factories` and packaging a jar file that the applications all use as a library.
The `SpringApplication` sends some special `ApplicationEvents` to the listeners (some even before the context is created) and then registers the listeners for events published by the `ApplicationContext` as well.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -38,7 +38,10 @@ import org.springframework.util.StringUtils;
* @author Dave Syer
* @author Phillip Webb
* @since 1.0.0
* @deprecated since 3.2.0 for removal in 3.4.0 as property based initialization is no
* longer recommended
*/
@Deprecated(since = "3.2.0", forRemoval = true)
public class DelegatingApplicationContextInitializer
implements ApplicationContextInitializer<ConfigurableApplicationContext>, Ordered {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -40,7 +40,10 @@ import org.springframework.util.StringUtils;
* @author Dave Syer
* @author Phillip Webb
* @since 1.0.0
* @deprecated since 3.2.0 for removal in 3.4.0 as property based initialization is no
* longer recommended
*/
@Deprecated(since = "3.2.0", forRemoval = true)
public class DelegatingApplicationListener implements ApplicationListener<ApplicationEvent>, Ordered {
// NOTE: Similar to org.springframework.web.context.ContextLoader

View File

@ -36,6 +36,8 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
*
* @author Phillip Webb
*/
@Deprecated(since = "3.2.0", forRemoval = true)
@SuppressWarnings("removal")
class DelegatingApplicationContextInitializerTests {
private final DelegatingApplicationContextInitializer initializer = new DelegatingApplicationContextInitializer();

View File

@ -37,6 +37,8 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Dave Syer
*/
@Deprecated(since = "3.2.0", forRemoval = true)
@SuppressWarnings("removal")
class DelegatingApplicationListenerTests {
private final DelegatingApplicationListener listener = new DelegatingApplicationListener();