cheapcontact - 2004-08-12

There appears to be an error in the example code found on page 21 of the spring_reference.pdf describing how to use Spring to use a static factory method to return an instance of an object instead of using a constructor.

The configuration for the example looks like this:

<bean id="exampleBean" class="examples.ExmapleBean"
         factory-method="createInstance">
...

The code that is implemented on the page looks like this:

public class ExampleBean {
   private ExampleBean(...) {
        ...
   }

   public static ExampleBean ExampleBean(..) {
      ExampleBean eb = new ExampleBean...);
      ...
      return eb;
   }
}

Should the method defined actually be name createInstance to match the factory-method in the config file?