Skip to content

Commit 3995883

Browse files
committed
Merge pull request #36251 from bbulgarelli
* pr/36251: Polish contribution Deprecate DelegatingApplicationContextInitializer and DelegatingApplicationListener Closes gh-36251
2 parents c19a0a7 + 60df7e3 commit 3995883

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/application.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ Spring Boot loads a number of such customizations for use internally from `META-
6161
There is more than one way to register additional customizations:
6262

6363
* Programmatically, per application, by calling the `addListeners` and `addInitializers` methods on `SpringApplication` before you run it.
64-
* Declaratively, per application, by setting the `context.initializer.classes` or `context.listener.classes` properties.
6564
* Declaratively, for all applications, by adding a `META-INF/spring.factories` and packaging a jar file that the applications all use as a library.
6665

6766
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.

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializer.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -38,7 +38,10 @@
3838
* @author Dave Syer
3939
* @author Phillip Webb
4040
* @since 1.0.0
41+
* @deprecated since 3.2.0 for removal in 3.4.0 as property based initialization is no
42+
* longer recommended
4143
*/
44+
@Deprecated(since = "3.2.0", forRemoval = true)
4245
public class DelegatingApplicationContextInitializer
4346
implements ApplicationContextInitializer<ConfigurableApplicationContext>, Ordered {
4447

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,7 +40,10 @@
4040
* @author Dave Syer
4141
* @author Phillip Webb
4242
* @since 1.0.0
43+
* @deprecated since 3.2.0 for removal in 3.4.0 as property based initialization is no
44+
* longer recommended
4345
*/
46+
@Deprecated(since = "3.2.0", forRemoval = true)
4447
public class DelegatingApplicationListener implements ApplicationListener<ApplicationEvent>, Ordered {
4548

4649
// NOTE: Similar to org.springframework.web.context.ContextLoader

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
*
3737
* @author Phillip Webb
3838
*/
39+
@Deprecated(since = "3.2.0", forRemoval = true)
40+
@SuppressWarnings("removal")
3941
class DelegatingApplicationContextInitializerTests {
4042

4143
private final DelegatingApplicationContextInitializer initializer = new DelegatingApplicationContextInitializer();

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
*
3838
* @author Dave Syer
3939
*/
40+
@Deprecated(since = "3.2.0", forRemoval = true)
41+
@SuppressWarnings("removal")
4042
class DelegatingApplicationListenerTests {
4143

4244
private final DelegatingApplicationListener listener = new DelegatingApplicationListener();

0 commit comments

Comments
 (0)