Package org.springframework.beans.factory.groovy

Examples of org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader


     * @see #loadBeanDefinitions
     */
    @Override
    protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws BeansException, IOException {
        // Create a new XmlBeanDefinitionReader for the given BeanFactory.
        GroovyBeanDefinitionReader beanDefinitionReader = new GroovyBeanDefinitionReader(beanFactory);

        // Configure the bean definition reader with this context's
        // resource loading environment.
        beanDefinitionReader.setEnvironment(this.getEnvironment());
        beanDefinitionReader.setResourceLoader(this);
//        beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(this));

        // Allow a subclass to provide custom initialization of the reader,
        // then proceed with actually loading the bean definitions.
        initBeanDefinitionReader(beanDefinitionReader);
View Full Code Here


                "GenericGroovyContextLoader does not support the getResourceSuffix() method");
    }

    @Override
    protected BeanDefinitionReader createBeanDefinitionReader(GenericApplicationContext context) {
        return new GroovyBeanDefinitionReader(context);
    }
View Full Code Here

   * @see #loadBeanDefinitions
   */
  @Override
  protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws BeansException, IOException {
    // Create a new XmlBeanDefinitionReader for the given BeanFactory.
    GroovyBeanDefinitionReader beanDefinitionReader = new GroovyBeanDefinitionReader(beanFactory);

    // Configure the bean definition reader with this context's
    // resource loading environment.
    beanDefinitionReader.setEnvironment(getEnvironment());
    beanDefinitionReader.setResourceLoader(this);

    // Allow a subclass to provide custom initialization of the reader,
    // then proceed with actually loading the bean definitions.
    initBeanDefinitionReader(beanDefinitionReader);
    loadBeanDefinitions(beanDefinitionReader);
View Full Code Here

   * @see AbstractGenericWebContextLoader#loadBeanDefinitions
   */
  @Override
  protected void loadBeanDefinitions(GenericWebApplicationContext context,
      WebMergedContextConfiguration webMergedConfig) {
    new GroovyBeanDefinitionReader(context).loadBeanDefinitions(webMergedConfig.getLocations());
  }
View Full Code Here

   * @see org.springframework.test.context.support.AbstractGenericContextLoader#loadBeanDefinitions
   */
  @Override
  protected void loadBeanDefinitions(GenericApplicationContext context, MergedContextConfiguration mergedConfig) {
    XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(context);
    GroovyBeanDefinitionReader groovyReader = new GroovyBeanDefinitionReader(context);

    for (String location : mergedConfig.getLocations()) {
      if (StringUtils.endsWithIgnoreCase(location, ".xml")) {
        xmlReader.loadBeanDefinitions(location);
      }
      else {
        groovyReader.loadBeanDefinitions(location);
      }
    }
  }
View Full Code Here

      return new PassthruModuleOptionsMetadata();
    }

    AbstractBeanDefinitionReader reader = source.getFilename().endsWith("xml") ?
        new XmlBeanDefinitionReader(beanFactory):
        new GroovyBeanDefinitionReader(beanFactory);

    reader.setResourceLoader(new PathMatchingResourcePatternResolver(classLoaderToUse));

    reader.loadBeanDefinitions(source);
View Full Code Here

    XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(
        (BeanDefinitionRegistry) context.getBeanFactory());
    xmlReader.setEnvironment(context.getEnvironment());

    GroovyBeanDefinitionReader groovyReader = new GroovyBeanDefinitionReader(
        (BeanDefinitionRegistry) context.getBeanFactory());
    groovyReader.setEnvironment(context.getEnvironment());


    for (String locationPattern : getLocations()) {
      try {
        Resource[] resources = resourceResolver.getResources(locationPattern);
        logger.info("resolving resource location pattern {}", locationPattern);
        for (Resource resource : resources) {
          if (resource.getFilename() != null) {
            if (resource.getFilename().endsWith(".xml")) {
              logger.info("loading XD extensions from {}", resource.getFilename());
              xmlReader.loadBeanDefinitions(resource);
            }
            else if (resource.getFilename().endsWith(".groovy")) {
              groovyReader.loadBeanDefinitions(resource);
            }
          }
        }
      }
      catch (IOException e) {
View Full Code Here

    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);
    this.scanner.addExcludeFilter(new ClassExcludeFilter(sources));
  }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader

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.