Skip to content

Commit 00b7782

Browse files
committed
Clarify destruction order effect in @dependsOn annotation javadoc
Issue: SPR-17384
1 parent 6f0c869 commit 00b7782

File tree

2 files changed

+126
-134
lines changed

2 files changed

+126
-134
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}.

0 commit comments

Comments
 (0)