Skip to content

Commit c73b98c

Browse files
committed
Clarify destruction order effect in @dependsOn annotation javadoc
Issue: SPR-17384 (cherry picked from commit 00b7782)
1 parent cf25efc commit c73b98c

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

spring-context/src/main/java/org/springframework/context/annotation/DependsOn.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -28,6 +28,12 @@
2828
* does not explicitly depend on another through properties or constructor arguments,
2929
* but rather depends on the side effects of another bean's initialization.
3030
*
31+
* <p>A depends-on declaration can specify both an initialization-time dependency and,
32+
* in the case of singleton beans only, a corresponding destruction-time dependency.
33+
* Dependent beans that define a depends-on relationship with a given bean are destroyed
34+
* first, prior to the given bean itself being destroyed. Thus, a depends-on declaration
35+
* can also control shutdown order.
36+
*
3137
* <p>May be used on any class directly or indirectly annotated with
3238
* {@link org.springframework.stereotype.Component} or on methods annotated
3339
* with {@link Bean}.

src/docs/asciidoc/core/core-beans.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,11 +1914,11 @@ delimiters:
19141914

19151915
[NOTE]
19161916
====
1917-
The `depends-on` attribute in the bean definition can specify both an initialization
1918-
time dependency and, in the case of <<beans-factory-scopes-singleton,singleton>> beans
1919-
only, a corresponding destroy time dependency. Dependent beans that define a
1920-
`depends-on` relationship with a given bean are destroyed first, prior to the given bean
1921-
itself being destroyed. Thus `depends-on` can also control shutdown order.
1917+
The `depends-on` attribute in the bean definition can specify both an initialization-time
1918+
dependency and, in the case of <<beans-factory-scopes-singleton,singleton>> beans only,
1919+
a corresponding destruction-time dependency. Dependent beans that define a `depends-on`
1920+
relationship with a given bean are destroyed first, prior to the given bean itself being
1921+
destroyed. Thus `depends-on` can also control shutdown order.
19221922
====
19231923

19241924

0 commit comments

Comments
 (0)