The current mechanism for adding your own custom LockFactory or LockFactoryProvider works well when outside of Spring, but has limitations when using Spring. Currently, to use a custom lock factory you do so like this:
<bean id="compass" class="org.compass.spring.LocalCompassBean">
<property name="compassSettings">
<props>
<prop key="compass.engine.store.lockFactory.type">com.mycompany.MyCustomLockFactory</prop>
...
</props>
</property>
</bean>
With this method, it is Compass, not Spring that instantiates my custom lock factory bean. This means that my bean has to have a default, empty constructor, and I cannot take advantage of Spring's dependency injection.
For example, I want to create a custom lock factory that uses named locks in a database to facilitate locking. I'd like my DatabaseLockFactory to be a singleton with a JDBC DataSource injected into it. So the configuration would look something like:
<bean id="compass" class="org.compass.spring.LocalCompassBean">
<property name="lockFactory"><ref bean="myLockFactory"/></property>
</property>
</bean>
I'm all for backwards compatibility, so maybe we can have this new way of injecting the lock factory in in addition to the current method.
<bean id="compass" class="org.compass.spring.LocalCompassBean">
<property name="settings">
<props>
<prop key="compass.engine.store.lockFactory.type"><ref ... /></prop>
...
</props>
</property>
</bean>