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
1 2bucket.container.ContainerManager.autowireComponent(myObject);
Where myObject
is the object instance that you wish to be autowired.
Rate this page: