Package jodd.petite

Class ScopedProxyManager


  • public class ScopedProxyManager
    extends java.lang.Object
    Manager for mixing scopes. 'Mixed scopes' is the situation when 'smaller' scope is injected into the 'bigger' scope. Trivial example is when prototype scoped bean is injected into singleton bean.

    Mixed scopes are handled using smart factory/proxy-wrapper singletons instead of 'smaller' scoped beans. On each method call of wrapped factory, smaller scoped bean will be looked up and that instance will be used for passing by the method call.

    Manager also has to determine if scope combination is candidate for mixed scopes.

    • Field Detail

      • aspect

        protected jodd.proxetta.ProxyAspect aspect
      • proxyClasses

        protected jodd.util.TypeCache<java.lang.Class> proxyClasses
      • proxies

        protected java.util.Map<java.lang.String,​java.lang.Object> proxies
    • Constructor Detail

      • ScopedProxyManager

        public ScopedProxyManager()
    • Method Detail

      • lookupValue

        public java.lang.Object lookupValue​(PetiteContainer petiteContainer,
                                            BeanDefinition targetBeanDefinition,
                                            BeanDefinition refBeanDefinition)
        Returns scoped proxy bean if injection scopes are mixed on some injection point. May return null if mixing scopes is not detected.
      • createMixingMessage

        protected java.lang.String createMixingMessage​(BeanDefinition targetBeanDefinition,
                                                       BeanDefinition refBeanDefinition)
        Creates mixed scope message.
      • createScopedProxyBean

        protected java.lang.Object createScopedProxyBean​(PetiteContainer petiteContainer,
                                                         BeanDefinition refBeanDefinition)
        Creates scoped proxy bean for given bean definition.