Why non-daemon thread is terminating if in jUnit test?
When you run your code from main it creates both beans, thus two threads – daemon and non-daemon. As long as non-daemon thread is running, your application won’t exit. So it works. It’s different when run from JUnit. As soon as JUnit test method completes (and it completes immediately after the Spring context is up), … Read more