Arthur Kopatsy

Greenhorn
+ Follow
since Apr 13, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Arthur Kopatsy

Hi,

I am new to both Spring and java in general and here is what I want to do.
I have a message bus internally, where events are posted and I need a thread that will be listening on this bus.
This thread must have access to the other beans (to update the DB for instance).

Here is my problem:
I am planning to use Spring for the dependency injection including for my "daemon bean". However, it looks like I need to use a contextlistener to start up my thread. If I understand this correctly, I will not be able to leverage the dependency injection if I start my thread this way.

My question is therefore the following:
How to start a long living thread at application startup time in a Spring application?

Your help would be greatly appreciated.

Thanks,

Arthur
13 years ago