eXo Platform 3.5

## Chapter 58. Component Plugin Priority

Since kernel version 2.0.6 it is possible to setup order of loading for ComponentPlugin. Use the ' priority' tag to define plugin's load priority. By default all plugins get priority '0'; they will be loaded in the container's natural way. If you want one plugin to be loaded later than the others then just set priority for it higher than zero.

Simple example of fragment of a configuration.xml.

    ...

    <component>

      <type>org.exoplatform.services.Component1</type>

    </component>

    <external-component-plugins>

      <target-component>org.exoplatform.services.Component1</target-component>

      <component-plugin>

        <name>Plugin1</name>

        <set-method>addPlugin</set-method>

        <type>org.exoplatform.services.plugins.Plugin1</type>

        <description>description</description>

        <priority>1</priority>

      </component-plugin>

      <component-plugin>

        <name>Plugin2</name>

        <set-method>addPlugin</set-method>

        <type>org.exoplatform.services.plugins.Plugin2</type>

        <description>description</description>

        <priority>2</priority>

      </component-plugin>

    </external-component-plugins>

    <external-component-plugins>

      <target-component>org.exoplatform.services.Component1</target-component>

      <component-plugin>

        <name>Plugin3</name>

        <set-method>addPlugin</set-method>

        <type>org.exoplatform.services.plugins.Plugin3</type>

        <description>description</description>

      </component-plugin>

    </external-component-plugins>

    ...

In the above example plugin 'Plugin3' will be loaded first because it has the default priority '0'. Then, plugin 'Plugin1' will be loaded and last one is plugin 'Plugin2'.