mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Document @ImportAutoConfiguration#exclude
Closes gh-7862
This commit is contained in:
parent
e44b595c0d
commit
e5e497ec3a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@ -31,6 +31,9 @@ import org.springframework.core.annotation.AliasFor;
|
||||
* rules as {@code @EnableAutoConfiguration} but restricts the auto-configuration classes
|
||||
* to the specified set, rather than consulting {@code spring.factories}.
|
||||
* <p>
|
||||
* Can also be used to {@link #exclude()} specific auto-configuration classes such that
|
||||
* they will never be applied.
|
||||
* <p>
|
||||
* Generally, {@code @EnableAutoConfiguration} should be used in preference to this
|
||||
* annotation, however, {@code @ImportAutoConfiguration} can be useful in some situations
|
||||
* and especially when writing tests.
|
||||
|
@ -5383,6 +5383,10 @@ providing a `@...Test` annotation that loads the `ApplicationContext` and one or
|
||||
more `@AutoConfigure...` annotations that can be used to customize auto-configuration
|
||||
settings.
|
||||
|
||||
NOTE: Each slice loads a very restricted set of auto-configuration classes. If you need to
|
||||
exclude one of them, most `@...Test` annotation provide an `excludeAutoConfiguration`
|
||||
attribute. Alternatively, you can use `@ImportAutoConfiguration#exclude`.
|
||||
|
||||
TIP: It's also possible to use the `@AutoConfigure...` annotations with the standard
|
||||
`@SpringBootTest` annotation. You can use this combination if you're not interested
|
||||
in '`slicing`' your application but you want some of the auto-configured test beans.
|
||||
|
Loading…
Reference in New Issue
Block a user