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));

Comment From: Tharik67

Hi, can i try working on this one?

Comment From: snicoll

@Tharik67 thanks for the offer but we're not quite sure how we would approach this. I've added a label to make that more clear.