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

  • ThreadLocal Values

    Hello.

    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 org.springframework.aop.target.ThreadLocalTargetSo 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="org.springframework.aop.target.ThreadLocalT argetSource">
    <property name="targetBeanName" value="businessObjectTarget"/>
    </bean>

    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.

    Comment

    Working...
    X