close

Filter

loading table of contents...

Headless Server Developer Manual / Version 2401

Table Of Contents

4.16.2 Beans For Plugins

Beans for plugins are regular Spring Beans provided by the main application context to the plugin context. The beans are meant to provide certain services of the Headless Server as part of the public Plugin API.

Warning

Warning

Many beans for plugins are regular service beans, also used in the main application context. As most of these beans are designed as singletons, they must never be used by a plugin via the configuration classes used in the main application context. Doing so will result in unpredictable side effects, as the beans, designed as singletons, are created in the plugin context also!

To use beans for plugins the correct way, import the intended beans for plugins Configuration to your plugin configuration class.

Headless Server offers these beans for plugins configuration classes to provide beans for plugins:

  • com.coremedia.cms.common.plugins.beans_for_plugins.CommonBeansForPluginsConfiguration

  • com.coremedia.blueprint.base.caas.beans_for_plugins.HeadlessBlueprintBaseBeansForPluginsConfiguration

@Configuration(proxyBeanMethods = false)
@Import({
        HeadlessBlueprintBaseBeansForPluginsConfiguration.class,
})
public class MyPluginConfiguration {
  @Bean
  public MyBean getMyBean(
    @Qualifier("caeSolrQueryBuilder") SolrQueryBuilder solrQueryBuilder
  ) {
    // create the bean
    ...
    return myBean;
  }
}

Example 4.11. Using a bean for plugin in a plugin configuration


CommonBeansForPluginsConfiguration

Provides shared beans which are not especially offered by Headless Server. For details about the provided beans, see the original JavaDoc.

HeadlessBlueprintBaseBeansForPluginsConfiguration

Provides Headless Server specific beans originating from Blueprint Base.

Bean NameTypeDescription
caeSolrQueryBuilder SolrQueryBuilder Provides a SolrQuery for the 'cmdismax' endpoint.
dynamicContentSolrQueryBuilder SolrQueryBuilder Provides a SolrQuery for the 'select' endpoint.
suggestionsSolrQueryBuilder SolrQueryBuilder Provides a SolrQuery for the 'suggest' endpoint.

Table 4.1. Available Beans in HeadlessBlueprintBaseBeansForPluginsConfiguration


Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.