/** * Create a new RootBeanDefinition for a singleton. * @param beanClass the class of the bean to instantiate * @see #setBeanClass */ public RootBeanDefinition(@Nullable Class<?> beanClass) { super(); setBeanClass(beanClass); }
/** * Create a new RootBeanDefinition for a singleton, * providing constructor arguments and property values. * @param beanClass the class of the bean to instantiate * @param cargs the constructor argument values to apply * @param pvs the property values to apply */ public RootBeanDefinition(@Nullable Class<?> beanClass, @Nullable ConstructorArgumentValues cargs, @Nullable MutablePropertyValues pvs) { super(cargs, pvs); setBeanClass(beanClass); }
/** * Create a new RootBeanDefinition for a singleton. * @param beanClass the class of the bean to instantiate * @see #setBeanClass */ public RootBeanDefinition(@Nullable Class<?> beanClass) { super(); setBeanClass(beanClass); }
/** * Create a new RootBeanDefinition for a singleton bean, constructing each instance * through calling the given supplier (possibly a lambda or method reference). * @param beanClass the class of the bean to instantiate * @param instanceSupplier the supplier to construct a bean instance, * as an alternative to a declaratively specified factory method * @since 5.0 * @see #setInstanceSupplier */ public <T> RootBeanDefinition(@Nullable Class<T> beanClass, @Nullable Supplier<T> instanceSupplier) { super(); setBeanClass(beanClass); setInstanceSupplier(instanceSupplier); }
/** * Create a new RootBeanDefinition for a singleton, * providing constructor arguments and property values. * @param beanClass the class of the bean to instantiate * @param cargs the constructor argument values to apply * @param pvs the property values to apply */ public RootBeanDefinition(@Nullable Class<?> beanClass, @Nullable ConstructorArgumentValues cargs, @Nullable MutablePropertyValues pvs) { super(cargs, pvs); setBeanClass(beanClass); }
private void registerTransactionalEventListenerFactory(ParserContext parserContext) { RootBeanDefinition def = new RootBeanDefinition(); def.setBeanClass(TransactionalEventListenerFactory.class); parserContext.registerBeanComponent(new BeanComponentDefinition(def, TransactionManagementConfigUtils.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME)); }
/** * Create a new RootBeanDefinition for a scoped bean, constructing each instance * through calling the given supplier (possibly a lambda or method reference). * @param beanClass the class of the bean to instantiate * @param scope the name of the corresponding scope * @param instanceSupplier the supplier to construct a bean instance, * as an alternative to a declaratively specified factory method * @since 5.0 * @see #setInstanceSupplier */ public <T> RootBeanDefinition(@Nullable Class<T> beanClass, String scope, @Nullable Supplier<T> instanceSupplier) { super(); setBeanClass(beanClass); setScope(scope); setInstanceSupplier(instanceSupplier); }
/** * Create a new RootBeanDefinition for a singleton bean, constructing each instance * through calling the given supplier (possibly a lambda or method reference). * @param beanClass the class of the bean to instantiate * @param instanceSupplier the supplier to construct a bean instance, * as an alternative to a declaratively specified factory method * @since 5.0 * @see #setInstanceSupplier */ public <T> RootBeanDefinition(@Nullable Class<T> beanClass, @Nullable Supplier<T> instanceSupplier) { super(); setBeanClass(beanClass); setInstanceSupplier(instanceSupplier); }
/** * Create a new RootBeanDefinition for a singleton, * using the given autowire mode. * @param beanClass the class of the bean to instantiate * @param autowireMode by name or type, using the constants in this interface * @param dependencyCheck whether to perform a dependency check for objects * (not applicable to autowiring a constructor, thus ignored there) */ public RootBeanDefinition(@Nullable Class<?> beanClass, int autowireMode, boolean dependencyCheck) { super(); setBeanClass(beanClass); setAutowireMode(autowireMode); if (dependencyCheck && getResolvedAutowireMode() != AUTOWIRE_CONSTRUCTOR) { setDependencyCheck(DEPENDENCY_CHECK_OBJECTS); } }
/** * Create a new RootBeanDefinition for a scoped bean, constructing each instance * through calling the given supplier (possibly a lambda or method reference). * @param beanClass the class of the bean to instantiate * @param scope the name of the corresponding scope * @param instanceSupplier the supplier to construct a bean instance, * as an alternative to a declaratively specified factory method * @since 5.0 * @see #setInstanceSupplier */ public <T> RootBeanDefinition(@Nullable Class<T> beanClass, String scope, @Nullable Supplier<T> instanceSupplier) { super(); setBeanClass(beanClass); setScope(scope); setInstanceSupplier(instanceSupplier); }
private void registerTransactionalEventListenerFactory(ParserContext parserContext) { RootBeanDefinition def = new RootBeanDefinition(); def.setBeanClass(TransactionalEventListenerFactory.class); parserContext.registerBeanComponent(new BeanComponentDefinition(def, TransactionManagementConfigUtils.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME)); }
/** * Create a new RootBeanDefinition for a singleton, * using the given autowire mode. * @param beanClass the class of the bean to instantiate * @param autowireMode by name or type, using the constants in this interface * @param dependencyCheck whether to perform a dependency check for objects * (not applicable to autowiring a constructor, thus ignored there) */ public RootBeanDefinition(@Nullable Class<?> beanClass, int autowireMode, boolean dependencyCheck) { super(); setBeanClass(beanClass); setAutowireMode(autowireMode); if (dependencyCheck && getResolvedAutowireMode() != AUTOWIRE_CONSTRUCTOR) { setDependencyCheck(DEPENDENCY_CHECK_OBJECTS); } }
@Override public BeanDefinition parse(Element element, ParserContext parserContext) { RootBeanDefinition definition = new RootBeanDefinition(); definition.setBeanClass(TestBean.class); MutablePropertyValues mpvs = new MutablePropertyValues(); mpvs.add("name", element.getAttribute("name")); mpvs.add("age", element.getAttribute("age")); definition.setPropertyValues(mpvs); parserContext.getRegistry().registerBeanDefinition(element.getAttribute("id"), definition); return null; } }
RootBeanDefinition def = new RootBeanDefinition(); try { def.setBeanClass(ClassUtils.forName(PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME, AnnotationConfigUtils.class.getClassLoader()));
@SuppressWarnings("unchecked") private static BeanDefinition parse(Element element, ParserContext parserContext, Class<?> beanClass, boolean required) { RootBeanDefinition beanDefinition = new RootBeanDefinition(); beanDefinition.setBeanClass(beanClass); beanDefinition.setLazyInit(false); String id = element.getAttribute("id"); if (className != null && className.length() > 0) { RootBeanDefinition classDefinition = new RootBeanDefinition(); classDefinition.setBeanClass(ReflectUtils.forName(className)); classDefinition.setLazyInit(false); parseProperties(element.getChildNodes(), classDefinition);
@SuppressWarnings("unchecked") private static BeanDefinition parse(Element element, ParserContext parserContext, Class<?> beanClass, boolean required) { RootBeanDefinition beanDefinition = new RootBeanDefinition(); beanDefinition.setBeanClass(beanClass); beanDefinition.setLazyInit(false); String id = element.getAttribute("id"); if (className != null && className.length() > 0) { RootBeanDefinition classDefinition = new RootBeanDefinition(); classDefinition.setBeanClass(ReflectUtils.forName(className)); classDefinition.setLazyInit(false); parseProperties(element.getChildNodes(), classDefinition);
if (resolvedClass != null && !mbd.hasBeanClass() && mbd.getBeanClassName() != null) { mbdToUse = new RootBeanDefinition(mbd); mbdToUse.setBeanClass(resolvedClass);
private RootBeanDefinition createRedisConverterDefinition() { RootBeanDefinition beanDef = new RootBeanDefinition(); beanDef.setBeanClass(MappingRedisConverter.class); ConstructorArgumentValues args = new ConstructorArgumentValues(); args.addIndexedArgumentValue(0, new RuntimeBeanReference(MAPPING_CONTEXT_BEAN_NAME)); beanDef.setConstructorArgumentValues(args); MutablePropertyValues props = new MutablePropertyValues(); props.add("referenceResolver", new RuntimeBeanReference(REDIS_REFERENCE_RESOLVER_BEAN_NAME)); props.add("customConversions", new RuntimeBeanReference(REDIS_CUSTOM_CONVERSIONS_BEAN_NAME)); beanDef.setPropertyValues(props); return beanDef; }
String registerDefaults = transportHandlersElement.getAttribute("register-defaults"); if (registerDefaults.equals("false")) { sockJsServiceDef.setBeanClass(TransportHandlingSockJsService.class);
proxyDefinition.setBeanClass(ProxyFactoryBean.class); proxyDefinition.setScope(targetDefinition.getScope()); proxyDefinition.setLazyInit(targetDefinition.isLazyInit());