How do I autowire a component?

How do I autowire a component?

Most of the time, you don't have to. All plugins will have their 'primary' objects (The macro in a macro plugin, the XWork actions in an XWork plugin, the RPC handler in an RPC plugin and so on...) autowired.

If you want to write an arbitrary object that is autowired, but that is not any particular plugin type itself, write a Component Plugin Module. The added advantage of this is that Confluence will then autowire other plugins with the component you have just written.

If, however, you find you need to autowire an arbitrary object with Spring components, use bucket.util.ContainerManager

bucket.container.ContainerManager.autowireComponent(myObject);

Where myObject is the object instance that you wish to be autowired.

Was this page helpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport