spring-cloud / spring-cloud/spring-cloud-commons
How to exclude a BootstrapConfiguration class ?
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 751
- Forks
- 744
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
Description
How to exclude a BootstrapConfiguration class ?
For example, There is a class in the spring.factories like below:
(B.T.W This file is in a jar file which is made by other team.)
org.springframework.cloud.bootstrap.BootstrapConfiguration=com.bd.FooConfiguration
But I DO NOT want to use this com.bd.FooConfiguration, How Could I exclude it ?
Dive into source code, I found that @BootstrapConfiguration has a exclude attribute.
org.springframework.cloud.bootstrap.BootstrapConfiguration
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface BootstrapConfiguration {
/**
* Excludes specific auto-configuration classes such that they will never be applied.
* @return classes to exclude
*/
Class<?>[] exclude() default {};
}
But when I use it like this:
@BootstrapConfiguration(exclude = {
com.bytedance.ea.cloud.tcc.TccConfigBootstrapConfiguration.class
})
@SpringBootApplication
public class Cloud_SpringBoot2ExampleApplication {
public static void main(String[] args) {
SpringApplication.run(Cloud_SpringBoot2ExampleApplication.class, args);
}
}
It never works. And I didn't find any usage or reference of the exclude attribute.

So I wonder:
- How to exclude a specific class?
- Is the
excludeattribute of@BootstrapConfigurationuseless ? Cause I Cannot find any reference of it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with org.springframework.cloud.bootstrap.BootstrapConfiguration and the spring.factories entry shown in the report, then trace whether the annotation's exclude attribute is read anywhere. Document the supported way to exclude com.bd.FooConfiguration and clarify whether the exclude attribute is effective, including a focused verification if the repository provides a relevant test entry point.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- backend
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100