/** * Register one or more annotated classes to be processed. * <p>Calls to {@code register} are idempotent; adding the same * annotated class more than once has no additional effect. * @param annotatedClasses one or more annotated classes, * e.g. {@link Configuration @Configuration} classes */ public void register(Class<?>... annotatedClasses) { for (Class<?> annotatedClass : annotatedClasses) { registerBean(annotatedClass); } }
/** * Register one or more annotated classes to be processed. * <p>Calls to {@code register} are idempotent; adding the same * annotated class more than once has no additional effect. * @param annotatedClasses one or more annotated classes, * e.g. {@link Configuration @Configuration} classes */ public void register(Class<?>... annotatedClasses) { for (Class<?> annotatedClass : annotatedClasses) { registerBean(annotatedClass); } }
public static Test suite() { GenericApplicationContext ac = new GenericApplicationContext(); AnnotatedBeanDefinitionReader bdr = new AnnotatedBeanDefinitionReader(ac); bdr.setScopeMetadataResolver(new Jsr330ScopeMetadataResolver()); bdr.registerBean(Convertible.class); bdr.registerBean(DriversSeat.class, Drivers.class); bdr.registerBean(Seat.class, Primary.class); bdr.registerBean(V8Engine.class); bdr.registerBean(SpareTire.class, "spare"); bdr.registerBean(Cupholder.class); bdr.registerBean(Tire.class, Primary.class); bdr.registerBean(FuelTank.class); ac.refresh(); Car car = ac.getBean(Car.class); return Tck.testsFor(car, false, true); }
/** * Register one or more annotated classes to be processed. * <p>Calls to {@code register} are idempotent; adding the same * annotated class more than once has no additional effect. * @param annotatedClasses one or more annotated classes, * e.g. {@link Configuration @Configuration} classes */ public void register(Class<?>... annotatedClasses) { for (Class<?> annotatedClass : annotatedClasses) { registerBean(annotatedClass); } }
@SuppressWarnings("unchecked") private BeanDefinition registerBean(BeanDefinitionRegistry registry, AnnotatedBeanDefinitionReader reader, String beanName, Class<?> type) { reader.registerBean(type, beanName); return registry.getBeanDefinition(beanName); }
@SuppressWarnings("unchecked") private BeanDefinition registerBean(BeanDefinitionRegistry registry, AnnotatedBeanDefinitionReader reader, String beanName, Class<?> type) { reader.registerBean(type, beanName); BeanDefinition definition = registry.getBeanDefinition(beanName); return definition; }