- protected void doStart(String aContext,
- Service[] aRequiredServices) {
- ServiceRegistry oldRegistry = REGISTRY.get();
- try {
- REGISTRY.set(getRegistry());
- try {
- _parentContext = new GenericApplicationContext();
-
- registerRequiredServices(aRequiredServices);
-
- _parentContext.refresh();
-
- parseConfigFiles();
-
- _context.addBeanFactoryPostProcessor(new PropertySetter(_properties));
- _context.refresh();
-
- exposeProvidedServices(aContext);
- } catch (Exception e) {
- throw new SystemAssemblyException(
- "Failed to assemble spring system", e);
- }
+ protected Scope doStart(Scope aExternalScope) {
+
+ SpringComponent old = THIS.get();
+ Scope oldScope = SCOPE.get();
+ THIS.set(this);
+ Scope scope = new DefaultScope(getProvidedInterfaces().toArray(new ProvidedInterface[0]), aExternalScope);
+ SCOPE.set(scope);
+ try {
+ GenericApplicationContext parentContext = new GenericApplicationContext();
+
+ registerRequiredServices(parentContext);
+ registerPropertyObjects(parentContext);
+
+ parentContext.refresh();
+
+ System.out.println("Parent context " + parentContext);
+
+ AbstractApplicationContext context = parseConfigFiles(parentContext);
+
+ context
+ .addBeanFactoryPostProcessor(new PropertySetter(_properties));
+ context.refresh();
+
+ exposeProvidedServices(context, aExternalScope);
+
+ scope.put(CONTEXT_KEY, context);
+ return scope;
+ } catch (Exception e) {
+ throw new SystemAssemblyException(
+ "Failed to assemble spring system " + getName(), e);