title: Application-wide configuration of Lambdaj FinalClassArgumentCreators. Where and how to do it?
body: <p>We have a problem with configuring lambdaj to work with Joda Time. Since <code>LocalDate</code> is a final class, Lambdaj needs to be initialized like following: (<a href="http://code.google.com/p/lambdaj/issues/detail?id=70">see bug 70</a>)</p>
  
  <pre><code>public class LocalDateArgumentCreator implements FinalClassArgumentCreator&lt;LocalDate&gt; {
      private final long MSECS_IN_DAY = 1000L * 60L * 60L * 24L;
      public LocalDate createArgumentPlaceHolder(int seed) {
          return new LocalDate((long)seed * MSECS_IN_DAY);
      }
  }
  ArgumentsFactory.registerFinalClassArgumentCreator(LocalDate.class, new LocalDateArgumentCreator());
  </code></pre>
  
  <p>Since we need this configuration to be applied virtually everywhere, we are short of options on how to implement this. Our application is a web application based on Spring and Wicket.</p>
  
  <p>I have come up with three different options:</p>
  
  <h3>1. Static initialization block in the core maven module</h3>
  
  <p>Since the core module is included in every other module, all modules would include the class. The remaining question is that do static blocks <em>always</em> get initialized even if there are no references to the target class?</p>
  
  <p>Example</p>
  
  <pre><code>public final class LambdajInitializer {
      static {
          // initialize like above
      }
  }
  </code></pre>
  
  <h3>2. An initializing bean in <code>applicationContext.xml</code></h3>
  
  <p>Downside: never gets initialized for non-Spring tests</p>
  
  <p>Example: In applicationContext-core.xml (included in every module)</p>
  
  <pre><code>&lt;bean class="...LambdajInitializer" /&gt;
  
  public class LambdajInitializer {
      @PostConstruct
      public void init() {
          // Lambdaj initialization
      }
  }
  </code></pre>
  
  <h3>3. A call to a initializing method in the Wicket application class</h3>
  
  <p>Downside: never gets initialized outside the web module</p>
  
  <pre><code>public class MyApplication extends WebApplication {
      @Override
      public void init() {
          ...
          // Lambdaj initialization
          ...
      }
  }
  </code></pre>
  
  <p>My question is: which is the preferable way to achieve this?</p>