On this page:

Recommended Plugin Module Type

The Component plugin module described below is available to OSGi-based plugins using version 2.x of the Atlassian Plugin Framework, supported in Confluence 2.10 and later.

We recommend that you use the new plugin module type described below, rather than the old-style Component and Spring Component module types. Confluence still supports the earlier module types, but the new OSGi-based plugin framework fixes a number of bugs and limitations experienced by the old-style plugin modules.

[Unable to render {include} The included page could not be found. ({include} をレンダリングできません。ページが見つかりませんでした)] を選択し、

Accessing Your Components

Accessing your components from within other plugin modules is extremely simple. All plugin modules in OSGi plugins are autowired. So to access a component, you need to add a Java setter method to your plugin module class.

For example, if you wanted to use the above helloWorldService component in an event listener module, you would add a field for the component and a setter method to the listener class as follows:

public class MyEventListener implements EventListener {
    private HelloWorldService helloWorldService;

    // ...

    public void setHelloWorldService(HelloWorldService helloWorldService) {
        this.helloWorldService = helloWorldService;
    }
}

Note that to access components in other plugins, the module needs to be marked as 'public' (as covered above) and imported into your plugin using a component-import.

関連トピック

Writing Confluence Plugins
Installing and Configuring Plugins Manually

Information sourced from Plugin Framework documentation

  • ラベルなし