Uploaded image for project: 'Spring OSGi'
  1. Spring OSGi
  2. OSGI-364

Ability to disable XML validation when loading context files

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Incomplete
    • Affects Version/s: 1.0
    • Fix Version/s: 1.1 RC1
    • Component/s: CORE
    • Labels:
      None

      Description

      We are using Spring OSGi on a platform that has limited resources ("embedded"). Going from "plain" OSGi to Spring-OSGi we found that startup time of our application (framework + bundles) has increased significantly (from 1m30s to 4m10s). After tracing we found that the biggest slowdown comes from the XML validation that the XmlBeanDefinitionReader performs.

      As a test we patched

      org.springframework.osgi.context.supportOsgiBundleXmlApplicationContext

      to configure the XmlBeanDefinitionReader to set validation mode to NONE, with the addition of 2 lines of code to the "loadBeanDefinitions" method:

      beanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
      beanDefinitionReader.setNamespaceAware(true);

      The setNamespaceAware(true) was an unexpected necessity to make Spring understand alternate namespaces (e.g. "osgi:") within the context files.

      With this patch to spring-osgi-core our startup time went from 4m10s to 1m40s on our hardware which has a poor CPU (300Mhz Intel Celeron).

      This improvement request is to evaluate whether mainline Spring OSGI could not be enhanced with a configuration property that defaults to doing XML validation as it does now but allows users to turn off validation for production use.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                costin Costin Leau
                Reporter:
                bterzic Boris Terzic
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: