public class

DefaultSpringContainerAccessor

extends Object
implements SpringContainerAccessor
java.lang.Object
   ↳ com.atlassian.plugin.osgi.spring.DefaultSpringContainerAccessor

Class Overview

Manages spring context access, including autowiring.

Summary

Public Constructors
DefaultSpringContainerAccessor(Object applicationContext)
Public Methods
void autowireBean(Object instance, AutowireCapablePlugin.AutowireStrategy autowireStrategy)
'Autowires' a given object - injects all dependencies defined in the constructor.
<T> T createBean(Class<T> clazz)
Will ask the container to instantiate a bean of the given class and does inject all constructor defined dependencies.
Object getBean(String id)
Retrieves a spring bean from the spring bean factory.
<T> Collection<T> getBeansOfType(Class<T> interfaceClass)
Gets all the beans that implement a given interface
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.plugin.module.ContainerAccessor
From interface com.atlassian.plugin.osgi.spring.SpringContainerAccessor

Public Constructors

public DefaultSpringContainerAccessor (Object applicationContext)

Public Methods

public void autowireBean (Object instance, AutowireCapablePlugin.AutowireStrategy autowireStrategy)

'Autowires' a given object - injects all dependencies defined in the constructor.

Parameters
instance the object instance to autowire
autowireStrategy the autowire strategy

public T createBean (Class<T> clazz)

Will ask the container to instantiate a bean of the given class and does inject all constructor defined dependencies. Currently we have only spring as a container that will autowire this bean.

Parameters
clazz the Class to instantiate. Cannot be null.
Returns
  • an instantiated bean.

public Object getBean (String id)

Retrieves a spring bean from the spring bean factory.

Parameters
id the id of the spring bean, cannot be null
Returns
  • the spring bean object

public Collection<T> getBeansOfType (Class<T> interfaceClass)

Gets all the beans that implement a given interface

Parameters
interfaceClass The interface class
Returns
  • A collection of implementations from the plugin's container