Class 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 Crowd SpringContextInstanceFactory, 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 of SpringContextInstanceFactory, it also allows us to fine-tune the wiring of the referenced beans.
    • Constructor Detail

      • ConfluenceSpringContextInstanceFactory

        public ConfluenceSpringContextInstanceFactory​(Map<Class<?>,​String> beanMapping)
    • Method Detail

      • getInstance

        public <T> T getInstance​(Class<T> clazz)
        Specified by:
        getInstance in interface com.atlassian.crowd.util.InstanceFactory
      • setApplicationContext

        public void setApplicationContext​(org.springframework.context.ApplicationContext applicationContext)
                                   throws org.springframework.beans.BeansException
        Specified by:
        setApplicationContext in interface org.springframework.context.ApplicationContextAware
        Throws:
        org.springframework.beans.BeansException
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws Exception
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        Exception