Package org.springframework.context.annotation

Examples of org.springframework.context.annotation.AnnotatedBeanDefinitionReader


*/
public class SpringAtInjectTck {

  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);
View Full Code Here


      WebMergedContextConfiguration webMergedConfig) {
    Class<?>[] annotatedClasses = webMergedConfig.getClasses();
    if (logger.isDebugEnabled()) {
      logger.debug("Registering annotated classes: " + ObjectUtils.nullSafeToString(annotatedClasses));
    }
    new AnnotatedBeanDefinitionReader(context).register(annotatedClasses);
  }
View Full Code Here

  protected void loadBeanDefinitions(GenericApplicationContext context, MergedContextConfiguration mergedConfig) {
    Class<?>[] annotatedClasses = mergedConfig.getClasses();
    if (logger.isDebugEnabled()) {
      logger.debug("Registering annotated classes: " + ObjectUtils.nullSafeToString(annotatedClasses));
    }
    new AnnotatedBeanDefinitionReader(context).register(annotatedClasses);
  }
View Full Code Here

   * @see AnnotatedBeanDefinitionReader
   * @see ClassPathBeanDefinitionScanner
   */
  @Override
  protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) {
    AnnotatedBeanDefinitionReader reader = new AnnotatedBeanDefinitionReader(beanFactory);
    ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(beanFactory);
    BeanNameGenerator beanNameGenerator = getBeanNameGenerator();
    ScopeMetadataResolver scopeMetadataResolver = getScopeMetadataResolver();
    if (beanNameGenerator != null) {
      reader.setBeanNameGenerator(beanNameGenerator);
      scanner.setBeanNameGenerator(beanNameGenerator);
    }
    if (scopeMetadataResolver != null) {
      reader.setScopeMetadataResolver(scopeMetadataResolver);
      scanner.setScopeMetadataResolver(scopeMetadataResolver);
    }

    String[] configLocations = getConfigLocations();
    if (configLocations != null) {
      for (String configLocation : configLocations) {
        try {
          Class<?> clazz = getClassLoader().loadClass(configLocation);
          if (logger.isInfoEnabled()) {
            logger.info("Successfully resolved class for [" + configLocation + "]");
          }
          reader.register(clazz);
        }
        catch (ClassNotFoundException ex) {
          if (logger.isDebugEnabled()) {
            logger.debug("Could not load class for config location [" + configLocation +
                "] - trying package scan. " + ex);
View Full Code Here

  static class EntireAppInitializer implements ApplicationContextInitializer<GenericApplicationContext> {

    @Override
    public void initialize(GenericApplicationContext applicationContext) {
      new AnnotatedBeanDefinitionReader(applicationContext).register(GlobalConfig.class);
    }
View Full Code Here

  @Override
  protected void loadBeanDefinitions(GenericApplicationContext context, MergedContextConfiguration mergedConfig) {
    // Order doesn't matter: <bean> always wins over @Bean.
    new XmlBeanDefinitionReader(context).loadBeanDefinitions(mergedConfig.getLocations());
    new AnnotatedBeanDefinitionReader(context).register(mergedConfig.getClasses());
  }
View Full Code Here

   * Create a new {@link AnnotationConfigEmbeddedWebApplicationContext} that needs to be
   * populated through {@link #register} calls and then manually {@linkplain #refresh
   * refreshed}.
   */
  public AnnotationConfigEmbeddedWebApplicationContext() {
    this.reader = new AnnotatedBeanDefinitionReader(this);
    this.scanner = new ClassPathBeanDefinitionScanner(this);
  }
View Full Code Here

   */
  public BeanDefinitionLoader(BeanDefinitionRegistry registry, Object... sources) {
    Assert.notNull(registry, "Registry must not be null");
    Assert.notEmpty(sources, "Sources must not be empty");
    this.sources = sources;
    this.annotatedReader = new AnnotatedBeanDefinitionReader(registry);
    this.xmlReader = new XmlBeanDefinitionReader(registry);
    if (isGroovyPresent()) {
      this.groovyReader = new GroovyBeanDefinitionReader(registry);
    }
    this.scanner = new ClassPathBeanDefinitionScanner(registry);
View Full Code Here

      this.context = new GenericApplicationContext();
    }

    // Finally load app config and start...
    BeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(this.context);
    AnnotatedBeanDefinitionReader classReader = new AnnotatedBeanDefinitionReader(context);

    for (String configLocation : configLocations)
    {
      if (!registerClass(classReader, configLocation))
      {
View Full Code Here

    context.refresh();
    context.registerShutdownHook();
  }

  protected void loadBeanDefinitions(GenericWebApplicationContext context, MergedContextConfiguration mergedConfig) {
    new AnnotatedBeanDefinitionReader(context).register(mergedConfig.getClasses());
    loadBeanDefinitions(context, mergedConfig.getLocations());
  }
View Full Code Here

TOP

Related Classes of org.springframework.context.annotation.AnnotatedBeanDefinitionReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.