Package org.springframework.core.io

Examples of org.springframework.core.io.DescriptiveResource


   * @see ConfigurationClass#ConfigurationClass(Class, ConfigurationClass)
   */
  public ConfigurationClass(AnnotationMetadata metadata, String beanName) {
    Assert.hasText(beanName, "Bean name must not be null");
    this.metadata = metadata;
    this.resource = new DescriptiveResource(metadata.getClassName());
    this.beanName = beanName;
  }
View Full Code Here


public final class FailFastProblemReporterTests {

  @Test(expected=BeanDefinitionParsingException.class)
  public void testError() throws Exception {
    FailFastProblemReporter reporter = new FailFastProblemReporter();
    reporter.error(new Problem("VGER", new Location(new DescriptiveResource("here")),
        null, new IllegalArgumentException()));
  }
View Full Code Here

        null, new IllegalArgumentException()));
  }

  @Test
  public void testWarn() throws Exception {
    Problem problem = new Problem("VGER", new Location(new DescriptiveResource("here")),
        null, new IllegalArgumentException());

    Log log = mock(Log.class);

    FailFastProblemReporter reporter = new FailFastProblemReporter();
View Full Code Here

   * @throws BeanDefinitionStoreException in case of loading or parsing errors
   */
  public int loadBeanDefinitions(InputSource inputSource, String resourceDescription)
      throws BeanDefinitionStoreException {

    return doLoadBeanDefinitions(inputSource, new DescriptiveResource(resourceDescription));
  }
View Full Code Here

    vc.setResourceLoaderPath("file:/mydir,file:/yourdir");
    vc.setResourceLoader(new ResourceLoader() {
      @Override
      public Resource getResource(String location) {
        if ("file:/yourdir/test".equals(location)) {
          return new DescriptiveResource("");
        }
        return new ByteArrayResource("test".getBytes(), "test");
      }
      @Override
      public ClassLoader getClassLoader() {
View Full Code Here

          throw new IllegalArgumentException("Namespace definition must supply a non-null URI");
        }
        NamespaceHandler namespaceHandler = this.xmlBeanDefinitionReader.getNamespaceHandlerResolver().resolve(uri);
        if (namespaceHandler == null) {
          throw new BeanDefinitionParsingException(new Problem("No namespace handler found for URI: " + uri,
              new Location(new DescriptiveResource(("Groovy")))));
        }
        this.namespaces.put(namespace, uri);
      }
    }
  }
View Full Code Here

      }
    }
  }

  private GroovyDynamicElementReader createDynamicElementReader(String namespace) {
    XmlReaderContext readerContext = this.xmlBeanDefinitionReader.createReaderContext(new DescriptiveResource("Groovy"));
    BeanDefinitionParserDelegate delegate = new BeanDefinitionParserDelegate(readerContext);
    boolean decorating = (this.currentBeanDefinition != null);
    if (!decorating) {
      this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(namespace);
    }
View Full Code Here

  }

  @Test
  public void postProcessorDoesNotOverrideRegularBeanDefinitions() {
    RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class);
    rbd.setResource(new DescriptiveResource("XML or something"));
    beanFactory.registerBeanDefinition("bar", rbd);
    beanFactory.registerBeanDefinition("config", new RootBeanDefinition(SingletonBeanConfig.class));
    ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor();
    pp.postProcessBeanFactory(beanFactory);
    beanFactory.getBean("foo", Foo.class);
View Full Code Here

  }

  @Test
  public void postProcessorDoesNotOverrideRegularBeanDefinitionsEvenWithScopedProxy() {
    RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class);
    rbd.setResource(new DescriptiveResource("XML or something"));
    BeanDefinitionHolder proxied = ScopedProxyUtils.createScopedProxy(
        new BeanDefinitionHolder(rbd, "bar"), beanFactory, true);
    beanFactory.registerBeanDefinition("bar", proxied.getBeanDefinition());
    beanFactory.registerBeanDefinition("config", new RootBeanDefinition(SingletonBeanConfig.class));
    ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor();
View Full Code Here

    @Override
    public Resource[] convert(String[] source) {
      Resource[] result = new Resource[source.length];
      for (int i = 0; i < source.length; i++) {
        result[i] = new DescriptiveResource(source[i].substring(1));
      }
      return result;
    }
View Full Code Here

TOP

Related Classes of org.springframework.core.io.DescriptiveResource

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.