mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Clarify the effects of ordering auto-configuration classes
Closes gh-22337
This commit is contained in:
parent
9558779dd4
commit
d9882f2c88
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 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.
|
||||
@ -22,9 +22,18 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
|
||||
/**
|
||||
* Hint for that an {@link EnableAutoConfiguration auto-configuration} should be applied
|
||||
* after other specified auto-configuration classes.
|
||||
* <p>
|
||||
* As with standard {@link Configuration @Configuration} classes, the order in which
|
||||
* auto-configuration classes are applied only affects the order in which their beans are
|
||||
* defined. The order in which those beans are subsequently created is unaffected and is
|
||||
* determined by each bean's dependencies and any {@link DependsOn @DependsOn}
|
||||
* relationships.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @since 1.0.0
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 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.
|
||||
@ -22,9 +22,18 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
|
||||
/**
|
||||
* Hint for that an {@link EnableAutoConfiguration auto-configuration} should be applied
|
||||
* Hint that an {@link EnableAutoConfiguration auto-configuration} should be applied
|
||||
* before other specified auto-configuration classes.
|
||||
* <p>
|
||||
* As with standard {@link Configuration @Configuration} classes, the order in which
|
||||
* auto-configuration classes are applied only affects the order in which their beans are
|
||||
* defined. The order in which those beans are subsequently created is unaffected and is
|
||||
* determined by each bean's dependencies and any {@link DependsOn @DependsOn}
|
||||
* relationships.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @since 1.0.0
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 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.
|
||||
@ -23,6 +23,8 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
|
||||
@ -31,6 +33,12 @@ import org.springframework.core.annotation.Order;
|
||||
* annotation. Allows auto-configuration classes to be ordered among themselves without
|
||||
* affecting the order of configuration classes passed to
|
||||
* {@link AnnotationConfigApplicationContext#register(Class...)}.
|
||||
* <p>
|
||||
* As with standard {@link Configuration @Configuration} classes, the order in which
|
||||
* auto-configuration classes are applied only affects the order in which their beans are
|
||||
* defined. The order in which those beans are subsequently created is unaffected and is
|
||||
* determined by each bean's dependencies and any {@link DependsOn @DependsOn}
|
||||
* relationships.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @since 1.3.0
|
||||
|
@ -7313,6 +7313,9 @@ For example, if you provide web-specific configuration, your class may need to b
|
||||
If you want to order certain auto-configurations that should not have any direct knowledge of each other, you can also use `@AutoConfigureOrder`.
|
||||
That annotation has the same semantic as the regular `@Order` annotation but provides a dedicated order for auto-configuration classes.
|
||||
|
||||
As with standard `@Configuration` classes, the order in which auto-configuration classes are applied only affects the order in which their beans are defined.
|
||||
The order in which those beans are subsequently created is unaffected and is determined by each bean's dependencies and any `@DependsOn` relationships.
|
||||
|
||||
|
||||
|
||||
[[boot-features-condition-annotations]]
|
||||
|
Loading…
Reference in New Issue
Block a user