Chapter 17. Introduction

17.1. Overview

Compass::Spring aim is to provide closer integration with the springframework. The following list summarizes the main integration points with Spring.

  • Support for a Compass level factory bean, with Spring IOC modelled configuration options.

  • Compass DAO level support (similar to the ORM dao support), with transaction integration and Compass DAO support class.

  • An extension on top of Spring's Hibernate 3 dao support which extends Compass::Gps Hibernate 3 device. Handles Spring proxing of the Hibernate SessionFactory.

  • An extension on top of Spring's OJB dao support which extends Compass::Gps OJB device. Mainly provides non programmatic configuration with OJB.

  • Extension to Spring MVC, providing Search controller (based on Compass::Core search capabilities) and an Index controller (based on Compass::Gps index operation).

17.2. Compass Definition in Application Context

Compass::Spring provides the ability to expose Compass as a Spring bean from an application context file. Application objects that need to access Compass will obtain a reference to a pre-defined instance via bean references. The following is an example of a Spring XML application context definition configuring Compass:

<beans>

    ...

<bean id="compass"
   class="org.compassframework.spring.LocalCompassBean">

   <property name="resourceLocations">
     <list>
       <value>classpath:org/compassframework/spring/test/A.cpm.xml</value>
     </list>
   </property>
   <property name="compassSettings">
      <props>
         <prop key="compass.engine.connection">
            target/testindex
         </prop>
         <!-- This is the default transaction handling
              (just explicitly setting it) -->
         <prop key="compass.transaction.factory">
            org.compassframework.core.transaction.LocalTransactionFactory
         </prop>
      </props>
   </property>
</bean>

    ...

</beans>