mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Allow ApplicationContextHelper to support both Lazy and NoAutoStart, where previously it only one at a time could be used.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18844 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -35,8 +35,8 @@ import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* A wrapper around {@link ClassPathXmlApplicationContext} which
|
||||
* stops abstractPropertyBackedBean based beans from being
|
||||
* AutoStarted by tweaking their property definitions.
|
||||
* stops Alfresco Subsystem (abstractPropertyBackedBean based)
|
||||
* beans from being AutoStarted by tweaking their property definitions.
|
||||
* You shouldn't do this in production, but it can be handy with
|
||||
* unit tests, as it allows a quicker startup by preventing
|
||||
* subsystems from starting up
|
||||
@@ -54,6 +54,15 @@ public class NoAutoStartClassPathXmlApplicationContext extends
|
||||
protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
|
||||
super.initBeanDefinitionReader(reader);
|
||||
|
||||
postInitBeanDefinitionReader(reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the work of disabling the autostart of the
|
||||
* Subsystem (abstractPropertyBackedBean) beans
|
||||
* on the xml bean reader
|
||||
*/
|
||||
protected static void postInitBeanDefinitionReader(XmlBeanDefinitionReader reader) {
|
||||
reader.setDocumentReaderClass(NoAutoStartBeanDefinitionDocumentReader.class);
|
||||
}
|
||||
|
||||
@@ -77,7 +86,8 @@ public class NoAutoStartClassPathXmlApplicationContext extends
|
||||
String propertyName = ele.getAttribute("name");
|
||||
if("autoStart".equals(propertyName)) {
|
||||
if("abstractPropertyBackedBean".equals(bd.getParentName())) {
|
||||
System.out.println("Preventing the autostart of " + bd.getBeanClassName());
|
||||
String id = ele.getParentNode().getAttributes().getNamedItem("id").getTextContent();
|
||||
System.out.println("Preventing the autostart of Subsystem " + id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user