Class ConfluenceSpringContextInstanceFactory
- java.lang.Object
-
- com.atlassian.confluence.user.crowd.ConfluenceSpringContextInstanceFactory
-
- All Implemented Interfaces:
com.atlassian.crowd.util.InstanceFactory,org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware
public class ConfluenceSpringContextInstanceFactory extends Object implements com.atlassian.crowd.util.InstanceFactory, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
An alternative to the CrowdSpringContextInstanceFactory, which rather than asking the Spring context to instantiate a new bean of the desired type, it resolves a statically-configured map of type names to bean names, and fetches that bean by name instead. The referenced beans must be prototype-scoped. In addition to removing the voodoo caused by the use ofSpringContextInstanceFactory, it also allows us to fine-tune the wiring of the referenced beans.
-
-
Constructor Summary
Constructors Constructor Description ConfluenceSpringContextInstanceFactory(Map<Class<?>,String> beanMapping)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()<T> TgetInstance(Class<T> clazz)ObjectgetInstance(String className)ObjectgetInstance(String className, ClassLoader classLoader)voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)
-
-
-
Method Detail
-
getInstance
public Object getInstance(String className) throws ClassNotFoundException
- Specified by:
getInstancein interfacecom.atlassian.crowd.util.InstanceFactory- Throws:
ClassNotFoundException
-
getInstance
public Object getInstance(String className, ClassLoader classLoader) throws ClassNotFoundException
- Specified by:
getInstancein interfacecom.atlassian.crowd.util.InstanceFactory- Throws:
ClassNotFoundException
-
getInstance
public <T> T getInstance(Class<T> clazz)
- Specified by:
getInstancein interfacecom.atlassian.crowd.util.InstanceFactory
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException- Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
-