We have a web application that presents both web resources (REST) and JMS MessageListener. Spring is the structure used to define and insert beans.
We defined beans in the "request" area to store information available for web resources. We would like to use these beans also in the JMS MessageListener, but the request area does not exist and throws an exception.
One solution to this problem is to use a custom thread-type scope implemented using Spring's “SimpleThreadScope”. But the destruction of beans is not implemented in this class. I know that there is a way to implement this using the "Spring user-domain stream example", but I prefer Application Server to manage the thread pool.
Do you have any other idea / suggestion on this issue?
An important aspect: the beans created in the field are used both by resources and through the JMS Message Listener.
Take an example. Imagine that we have the following classes:
- Class BeanInScope1
- Class WebResource1
- Class Service1
- Class MessageListener1
" Service1" " BeanInScope1", " Service1" " WebResource1" " MessageListener1", , " BeanInScope1" WebResource1 "" MessageListener1".
, ...