spring-projects / spring-projects/spring-boot

Allow spring.factories instances to be changed, configured or removed

Open
#24,947 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: pending-design-work type: enhancement
Dominant language
Java
Stars
81.5k
Forks
42.7k
Avg merge
2d 4h
Merged PRs (30d)
65

Description

When SpringApplication loads instances via spring.factories it's quite hard to change, customize or remove them. Often users need to resort to a BeanFactoryPostProcessor or the like.

For example, the LoggingApplicationListener has a setParseArgs method, but it's very hard to actually call it.

Another example is documented in #24878 where specific listeners needed to be removed.

We might be able to offer a Customizer interface that would allow instances to be changed to removed. Something like:

SpringApplication application = new StringApplication(MyApp.class);
application.addSpringFactoryInstanceCustomizer((LoggingApplicationListener) listener -> listener.setParseArgs(false));

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with SpringApplication's loading of instances from spring.factories, then review LoggingApplicationListener and its setParseArgs method. Read the example in #24878 to understand removal needs. Done should allow loaded instances to be changed, configured, or removed through the proposed customization mechanism.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.