protected SlingBean createComponent ( ) throws ClassNotFoundException , IllegalAccessException , InstantiationException { SlingBean component = null ; Class < ? extends SlingBean > type = getComponentType ( ) ; if ( type != null ) { BeanFactory factoryRule = type . getAnnotation ( BeanFactory . class ) ; if ( factoryRule != null ) { SlingBeanFactory factory = context . getService ( factoryRule . serviceClass ( ) ) ; if ( factory != null ) { return factory . createBean ( context , getModelResource ( context ) , type ) ; } } BeanContext baseContext = context . withResource ( getModelResource ( context ) ) ; component = baseContext . adaptTo ( type ) ; injectServices ( component ) ; additionalInitialization ( component ) ; } return component ; }
Create the requested component instance