79553779

Date: 2025-04-03 19:05:21
Score: 1
Natty:
Report link

I suggest to use SpringApplicationRunListener:

class AppListenerExcluder implements SpringApplicationRunListener {

    AppListenerExcluder(SpringApplication app, String[] args) {
        app.setListeners(
                app.getListeners().stream()
                        .filter(not(listener -> listener instanceof UnwantedListener))
                        .toList());
    }
}

We have to declare It in spring.factories in app "resources" folder:
src
ㅤmain
ㅤㅤresources
ㅤㅤㅤMETA-INF
ㅤㅤㅤㅤspring.factories

ㅤㅤㅤㅤㅤorg.springframework.boot.SpringApplicationRunListener=\
ㅤㅤㅤㅤ  ㅤdev.rost.client.config.AppListenerExcluder

GitHub 🔗

Reasons:
  • Contains signature (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Rostik