Blueprint Developer Manual / Version 2207
Table Of Contents
Plugins can also extend other plugins. To this end plugins can define extension points for which they collect
implementing beans from add-on plugins using the AddOnManager
.
A plugin can have multiple dependencies but can only be an add-on for one other plugin.
Add-ons can also inject beans from the extended plugin in the same way as if the add-on had a dependency
on the extended plugin.
The AddOnManager
can be injected by importing the configuration class
com.coremedia.cms.common.plugins.plugin_framework.addons.AddOnConfiguration.
Example
PluginB is an add-on for PluginA and provides an extension for PluginA's extension point.
PluginA
plugin.id=pluginA plugin.version=1.2.3 plugin.configuration-class=com.acme.plugin_a.PluginAConfiguration
Example 4.14. PluginA plugin.properties
import com.coremedia.cms.common.plugins.plugin_base.ExtensionPoint;
@ExtensionPoint
public class SomeExtensionPointForA {}
Example 4.15. SomeExtensionPointForA
@Import(AddOnConfiguration.class) @Configuration(proxyBeanMethods = false) class PluginAConfiguration { @Bean UsageOfExtensionPoints usageOfExtensionPoints(AddOnManager addOnManager) { return new UsageOfExtensionPoints(addOnManager.getExtensions(SomeExtensionPointForA.class)); } }
Example 4.16. PluginAConfiguration
PluginB
plugin.id=pluginB plugin.version=0.1.0 plugin.configuration-class=com.acme.plugin_b.PluginBConfiguration plugin.add-on-for=pluginA
Example 4.17. PluginB plugin.properties
...
@Bean
SomeExtensionPointForAImpl someExtensionPointForAImpl() {
return new SomeExtensionPointForAImpl();
}
...
Example 4.18. PluginBConfiguration
public class SomeExtensionPointForAImpl extends SomeExtensionPointForA {}
Example 4.19. SomeExtensionPointForAImpl