From c73b98cf3328fd5eff0bdf67fed65d9bf26662d1 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 18 Oct 2018 18:03:44 +0200 Subject: [PATCH] Clarify destruction order effect in @DependsOn annotation javadoc Issue: SPR-17384 (cherry picked from commit 00b7782b5f09c46f17b30ea0dda28f87efe242b8) --- .../springframework/context/annotation/DependsOn.java | 8 +++++++- src/docs/asciidoc/core/core-beans.adoc | 10 +++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/annotation/DependsOn.java b/spring-context/src/main/java/org/springframework/context/annotation/DependsOn.java index 121cec3aeb..48f3dc0547 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/DependsOn.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/DependsOn.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2018 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. @@ -28,6 +28,12 @@ import java.lang.annotation.Target; * does not explicitly depend on another through properties or constructor arguments, * but rather depends on the side effects of another bean's initialization. * + *

A depends-on declaration can specify both an initialization-time dependency and, + * in the case of singleton beans only, a corresponding destruction-time dependency. + * Dependent beans that define a depends-on relationship with a given bean are destroyed + * first, prior to the given bean itself being destroyed. Thus, a depends-on declaration + * can also control shutdown order. + * *

May be used on any class directly or indirectly annotated with * {@link org.springframework.stereotype.Component} or on methods annotated * with {@link Bean}. diff --git a/src/docs/asciidoc/core/core-beans.adoc b/src/docs/asciidoc/core/core-beans.adoc index 4db8a578b4..5b5cf3c8a6 100644 --- a/src/docs/asciidoc/core/core-beans.adoc +++ b/src/docs/asciidoc/core/core-beans.adoc @@ -1914,11 +1914,11 @@ delimiters: [NOTE] ==== -The `depends-on` attribute in the bean definition can specify both an initialization -time dependency and, in the case of <> beans -only, a corresponding destroy time dependency. Dependent beans that define a -`depends-on` relationship with a given bean are destroyed first, prior to the given bean -itself being destroyed. Thus `depends-on` can also control shutdown order. +The `depends-on` attribute in the bean definition can specify both an initialization-time +dependency and, in the case of <> beans only, +a corresponding destruction-time dependency. Dependent beans that define a `depends-on` +relationship with a given bean are destroyed first, prior to the given bean itself being +destroyed. Thus `depends-on` can also control shutdown order. ====