1 package org.springframework.osgi.atlassian;
2
3 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
4 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
5 import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
6
7
8
9
10
11
12
13
14
15
16
17 public class NonValidatingOsgiBundleXmlApplicationContext extends OsgiBundleXmlApplicationContext
18 {
19 public NonValidatingOsgiBundleXmlApplicationContext(String[] configLocations)
20 {
21 super(configLocations);
22 }
23
24 @Override
25 protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader)
26 {
27 super.initBeanDefinitionReader(beanDefinitionReader);
28 beanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
29 beanDefinitionReader.setNamespaceAware(true);
30 }
31
32 @Override
33 protected void customizeBeanFactory(final DefaultListableBeanFactory beanFactory)
34 {
35 if (Boolean.getBoolean("atlassian.disable.spring.cache.bean.metadata"))
36 {
37 beanFactory.setCacheBeanMetadata(false);
38 }
39 super.customizeBeanFactory(beanFactory);
40 }
41
42 @Override
43 protected DefaultListableBeanFactory createBeanFactory()
44 {
45 if (Boolean.getBoolean("atlassian.disable.spring.jaas"))
46 {
47 return new UnsecureListableBeanFactory(getInternalParentBeanFactory());
48 }
49 return super.createBeanFactory();
50 }
51 }