Configuring global execution / task listeners programatically

I want to use global execution / task listeners but set them up programatically. According to this documentation, it can be done but there are no examples: https://docs.camunda.org/manual/latest/user-guide/process-engine/process-engine-plugins/

Here is my application class with my execution / task listeners:

@SpringBootApplication
@EnableProcessApplication("DemoApp")
public class DemoApp {
    public static void main(final String[] args) {
        new DemoApp().run(args);
    }

    public void run(final String[] args) {
        SpringApplication.run(DemoApp.class, args);
    }

    public TaskListener getTaskListener() {
        return new TaskListener() {
            public void notify(DelegateTask delegateTask) {
            }
        };
    }

    public ExecutionListener getExecutionListener() {
        return new ExecutionListener() {
            public void notify(DelegateExecution execution) throws Exception {     
            } 
       };
    }
}

So how do you go about programatically configuring the org.camunda.bpm.application.impl.event.ProcessApplicationEventListenerPlugin plugin?

Thanks in advance.