@Test public void testThreadScope() throws Exception { threadedService.setValue(VALUE_FIRST); Assert.assertEquals(VALUE_FIRST, threadedService.getValue()); ThreadedService ts = applicationContext.getBean(BEAN_NAME, ThreadedService.class); Assert.assertEquals(VALUE_FIRST, ts.getValue()); Thread thread = new Thread(new Runnable() { public void run() { testInOtherThread(); } }); thread.start(); thread.join(); Assert.assertEquals(VALUE_FIRST, threadedService.getValue()); ((ScopedObject)threadedService).removeFromScope(); Assert.assertNull(threadedService.getValue()); }
public ThreadScope() { ThreadScopeContextHolder.clear(); }
ThreadScope implements Scope, DisposableBean { public ThreadScope() { ThreadScopeContextHolder.clear(); } }
ThreadScope implements Scope, DisposableBean { public ThreadScope() { ThreadScopeContextHolder.clear(); } ThreadScope(); }
ThreadScope implements Scope, DisposableBean { public ThreadScope() { ThreadScopeContextHolder.clear(); } ThreadScope(); Object get(String name, ObjectFactory<?> factory); Object remove(String name); void registerDestructionCallback(String name, Runnable callback); Object resolveContextualObject(String key); String getConversationId(); void destroy(); }
ThreadScope implements Scope, DisposableBean { public ThreadScope() { ThreadScopeContextHolder.clear(); } ThreadScope(); Object get(String name, ObjectFactory<?> factory); Object remove(String name); void registerDestructionCallback(String name, Runnable callback); Object resolveContextualObject(String key); String getConversationId(); void destroy();  }