Announcement Announcement Module
No announcement yet.
ThreadLocal Values Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • ThreadLocal Values


    I want to set a Thread Local variable via an AOP interceptor, but I don't know how to use Spring facilities for Thread Local variables.
    I tried to declare a bean of urce class but with no sucess.
    Does anyone have an example of how to set a value in the Thread context, so the next methods in the chain could read the value?

    In the documentation I saw:
    <bean id="threadlocalTargetSource" class=" argetSource">
    <property name="targetBeanName" value="businessObjectTarget"/>

    Do I have to declare a dependency between my business object and the threadlocalTargetSource ? My business object is actually a ProxyFactoryBean.

    Thanks for your help.

  • #2
    You shouldn't have to declare anymore of a dependency than you have now.

    But keep in mind that businessObjectTarget has to be a non-singleton.