@Test
public void testThreadScope() throws Exception {

	// verify that set/get works in normal case
	threadedService.setValue(VALUE_FIRST);
	Assert.assertEquals(VALUE_FIRST, threadedService.getValue());
	// assure bean is not treated as prototype
	ThreadedService ts = applicationContext.getBean(BEAN_NAME, ThreadedService.class);
	Assert.assertEquals(VALUE_FIRST, ts.getValue());
	Thread thread = new Thread(new Runnable() {
		public void run() {
			// we are in the thread, now create the autowired class and test:
			testInOtherThread();
		}
	});
	thread.start();
	thread.join();
	// now verify that we can clear the thread data
	Assert.assertEquals(VALUE_FIRST, threadedService.getValue());
	((ScopedObject)threadedService).removeFromScope();
	Assert.assertNull(threadedService.getValue());
}