Package org.springframework.beans.factory.xml

Examples of org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver


  }

  public BeanDefinition parseCustomElement(Element ele, BeanDefinition containingBd) {
    String namespaceUri = getNamespaceURI(ele);
    // new DefaultNamespaceHandlerResolver()
    NamespaceHandler handler = new DefaultNamespaceHandlerResolver().resolve(namespaceUri);
    if (handler == null) {
      error("Unable to locate Spring NamespaceHandler for XML schema namespace [" + namespaceUri + "]",
          ele);
      return null;
    }
View Full Code Here


    protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
        // Spring always creates a new one of these, which takes a fair amount
        // of time on startup (nearly 1/2 second) as it gets created for every
        // spring context on the classpath
        if (nsHandlerResolver == null) {
            nsHandlerResolver = new DefaultNamespaceHandlerResolver();
        }
        reader.setNamespaceHandlerResolver(nsHandlerResolver);
       
        String mode = SystemUtils.getSpringValidationMode();
        if (null != mode) {
View Full Code Here

    protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
        // Spring always creates a new one of these, which takes a fair amount
        // of time on startup (nearly 1/2 second) as it gets created for every
        // spring context on the classpath
        if (nsHandlerResolver == null) {
            nsHandlerResolver = new DefaultNamespaceHandlerResolver();
        }
        reader.setNamespaceHandlerResolver(nsHandlerResolver);
       
        String mode = SystemUtils.getSpringValidationMode();
        if (null != mode) {
View Full Code Here

    protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
        // Spring always creates a new one of these, which takes a fair amount
        // of time on startup (nearly 1/2 second) as it gets created for every
        // spring context on the classpath
        if (nsHandlerResolver == null) {
            nsHandlerResolver = new DefaultNamespaceHandlerResolver();
        }
        reader.setNamespaceHandlerResolver(nsHandlerResolver);
       
        String mode = SystemUtils.getSpringValidationMode();
        if (null != mode) {
View Full Code Here

* @author Rick Evans
*/
public class DefaultNamespaceHandlerResolverTests extends TestCase {

  public void testResolvedMappedHandler() {
    DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(getClass().getClassLoader());
    NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
    assertNotNull("Handler should not be null.", handler);
    assertEquals("Incorrect handler loaded", UtilNamespaceHandler.class, handler.getClass());
  }
View Full Code Here

    assertNotNull("Handler should not be null.", handler);
    assertEquals("Incorrect handler loaded", UtilNamespaceHandler.class, handler.getClass());
  }

  public void testResolvedMappedHandlerWithNoArgCtor() {
    DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver();
    NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
    assertNotNull("Handler should not be null.", handler);
    assertEquals("Incorrect handler loaded", UtilNamespaceHandler.class, handler.getClass());
  }
View Full Code Here

  }

  public void testNonExistentHandlerClass() throws Exception {
    String mappingPath = "org/springframework/beans/factory/xml/support/nonExistent.properties";
    try {
      new DefaultNamespaceHandlerResolver(getClass().getClassLoader(), mappingPath);
      // pass
    }
    catch (Throwable ex) {
      fail("Non-existent handler classes must be ignored: " + ex);
    }
View Full Code Here

  }

  public void testResolveInvalidHandler() throws Exception {
    String mappingPath = "org/springframework/beans/factory/xml/support/invalid.properties";
    try {
      new DefaultNamespaceHandlerResolver(getClass().getClassLoader(), mappingPath);
      fail("Should not be able to map a class that doesn't implement NamespaceHandler");
    }
    catch (Throwable expected) {
    }
  }
View Full Code Here

    }
  }

  public void testCtorWithNullClassLoaderArgument() throws Exception {
    // simply must not bail...
    new DefaultNamespaceHandlerResolver(null);
  }
View Full Code Here

  }

  public void testCtorWithNullClassLoaderArgumentAndNullMappingLocationArgument() throws Exception {
    new AssertThrows(IllegalArgumentException.class) {
      public void test() throws Exception {
        new DefaultNamespaceHandlerResolver(null, null);
      }
    }.runTest();
  }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver

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.