Results 1 to 2 of 2

Thread: ThreadLocal Values

  1. #1
    Join Date
    Sep 2005
    Posts
    18

    Default 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. #2
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    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.
    Bill

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •