Last updated Jul 8, 2024

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 Struts actions in a Struts 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


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

Rate this page: