View Javadoc

1   package org.springframework.osgi.atlassian;
2   
3   import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
4   import org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext;
5   
6   /**
7    * Application context that initializes the bean definition reader to not validate via XML Schema.  Note that by
8    * turning this off, certain defaults won't be populated like expected.  For example, XML Schema provides the default
9    * autowire value of "default", but without this validation, that value is not set so autowiring will be turned off.
10   *
11   * This class exists in the same package as the parent so the log messages won't get confused as the parent class
12   * logs against the instance class.
13   *
14   * @since 2.5.0
15   */
16  public class NonValidatingOsgiBundleXmlApplicationContext extends OsgiBundleXmlApplicationContext
17  {
18      public NonValidatingOsgiBundleXmlApplicationContext(String[] configLocations)
19      {
20          super(configLocations);
21      }
22  
23      @Override
24      protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader)
25      {
26          super.initBeanDefinitionReader(beanDefinitionReader);
27          beanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
28          beanDefinitionReader.setNamespaceAware(true);
29      }
30  }