Skip to content

Tag: event-listener

Using AOP and DI itself causes Spring ApplicationListener to be fired twice

Software versions Spring Version 5.3.18 and earlier JDK Version 1.8.0_202 Overview When I use Spring ApplicationListener, in order to prevent transaction invalidation, my ApplicationListener implementation class writes the following code (of course, the code can be written differently to avoid this problem), which will cause my listener to trigger twice after the event is published. I think it’s not normal,

How to run consumer @StreamListener only after ApplicationReadyEvent method completed?

I have a consumer method with And I have a method with an event listener Is it possible to configure @StreamListener to start listening only after @EventListener method is completed? Answer According to Spring Cloud Stream docs you could use property<bindingName>.consumer.autoStartup=false which will stop BindingService from starting automatically starting consumer binding. Then you can do it yourself whenever you

How to use my own method for event listening in javax.swing

I’m actually started learning about javax.swing for graphics. For event listening like KeyListener, MouseListener etc., I have to implement all their methods with their own headers. I previously worked in JS, and there event listening is very simple. So I decided to create my own class myButton which extends JButton and also implements all the listeners required. But the statements