org.qi4j.library.spring.bootstrap

## Class Qi4jApplicationBootstrap

- java.lang.Object
- - org.qi4j.library.spring.bootstrap.Qi4jApplicationBootstrap

-     public abstract class Qi4jApplicationBootstrap
      extends Object

  Run a Zest Application as a Spring Bean and export its Services to Spring.

  Steps to export Zest service:

  - Create spring BeanFactory service of qi4j services to export.
  - Create a class that extends `Qi4jApplicationBootstrap`.
  - Sets the layer and module that register BeanFactory service.
  - Assemble qi4j application by implementing #assemble method.
  - Sets the identity of bean factory service. This identity is the spring bean name.
  - Declare qi4j bootstrap in spring xml application context.

         <?xml version="1.0" encoding="UTF-8"?>

         <beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:qi4j="http://www.qi4j.org/schema/qi4j/spring"
         xsi:schemaLocation="
         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
         http://www.qi4j.org/schema/qi4j/spring http://www.qi4j.org/schema/qi4j/spring/spring-0.5.xsd">

         <!-- class that implements Qi4jApplicationBootstrap -->

         <qi4j:bootstrap class="org.qi4j.library.spring.bootstrap.Qi4jTestBootstrap"/>

         <bean id="commentServiceHolder" class="org.qi4j.library.spring.bootstrap.CommentServiceHolder">

         <constructor-arg ref="commentService"/> <!-- Reference qi4j comment service -->

         </bean>

  Importing Spring beans as services

  1. Application bootstrap class must implement interface `ApplicationContextAware`.
  2. In the application bootstrap import service to the module using method `ModuleAssembly.importedServices(Class...)`.
  3. Set concrete Spring bean as meta-data of the imported service.

  Look at org.qi4j.library.spring.bootstrap.Qi4jExportServiceTest for sample implementation.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Qi4jApplicationBootstrap()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `assemble(ApplicationAssembly applicationAssembly)` Assembles qi4j application.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Qi4jApplicationBootstrap

          public Qi4jApplicationBootstrap()

  - ### Method Detail

    - #### assemble

          public abstract void assemble(ApplicationAssembly applicationAssembly)
                                 throws AssemblyException

      Assembles qi4j application.
      Parameters:
        `applicationAssembly` - qi4j application assembly. Must not be `null`.
      Throws:
        `AssemblyException` - Thrown if assemblies fails.