What code line can you use to publish the event in the following application?
@SpringBootApplication
public class EventsAndListenersProjectApplication {
public static void main(String[] args) {
SpringApplication.run(EventsAndListenersProjectApplication.class, args);
}
}
@Component
class Runner implements CommandLineRunner {
private final ApplicationEventPublisher eventPublisher;
public Runner(ApplicationEventPublisher eventPublisher) {
this.eventPublisher = eventPublisher;
}
@Override
public void run(String... args) {
TestEvent event = new TestEvent(this);
//code line to publish event
}
}