title: Spring set a property using a runtime object?
body: <p>I have a hard time figuring out how to set a property with the help of spring annotations.</p>
  
  <p>I have an abstract base class.</p>
  
  <pre><code>abstract class AbstractTest{
   private static Session session;
  
   @BeforeClass
   public static void initApplication() throws Exception {
    session = new Session();
    ...
   }
  
   public Session getSession(){
  </code></pre>
  
  <p>I have an test class extending my AbstractTest.</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration
  public class RealTest extends AbstractTest{
  
   @Autowired
   Service service;
  </code></pre>
  
  <p>I have a service that needs to make use of the session object and I want it to be "autoset" to the session object.</p>
  
  <pre><code>public class ServiceImpl implements Service {
  
  // @AutoSomething how to make this work?
  private Session session;
  </code></pre>
  
  <p>The spring file that is automatically used for my RealTest thanks to the @ContextConfiguration Annotation</p>
  
  <pre><code>&lt;bean id="Service" class="...ServiceImpl" &gt;
   &lt;property name="session"&gt;
    getSession()?? // What's the syntax or how to do this?
   &lt;/property&gt;
  </code></pre>