X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=eclipse%2Fruntime%2Forg.argeo.eclipse.ui%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Feclipse%2Fspring%2FSpringExtensionFactory.java;fp=eclipse%2Fruntime%2Forg.argeo.eclipse.ui%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Feclipse%2Fspring%2FSpringExtensionFactory.java;h=aa0295d56a80fd3e18a8fb1ea0d9af8f244c4f27;hb=0df1bdb87bb301067f1d0d18a6e0b1782b0fe7f4;hp=f20e1d1249f70c8e3a73fddaee6226ac9ee0e95d;hpb=24652d1f8e6e8293ebae76121f0369a262ba503a;p=lgpl%2Fargeo-commons.git diff --git a/eclipse/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/spring/SpringExtensionFactory.java b/eclipse/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/spring/SpringExtensionFactory.java index f20e1d124..aa0295d56 100644 --- a/eclipse/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/spring/SpringExtensionFactory.java +++ b/eclipse/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/spring/SpringExtensionFactory.java @@ -63,9 +63,9 @@ public class SpringExtensionFactory implements IExecutableExtensionFactory, public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { String bundleSymbolicName = config.getContributor().getName(); - ApplicationContext appContext = ApplicationContextTracker + ApplicationContext applicationContext = ApplicationContextTracker .getApplicationContext(bundleSymbolicName); - if (appContext == null) + if (applicationContext == null) throw new ArgeoException( "Cannot find application context for bundle " + bundleSymbolicName); @@ -75,7 +75,15 @@ public class SpringExtensionFactory implements IExecutableExtensionFactory, throw new ArgeoException("Cannot find bean name for extension " + config); - this.bean = appContext.getBean(beanName); + if (!applicationContext.containsBean(beanName)) { + if (beanName.startsWith(bundleSymbolicName)) + beanName = beanName.substring(bundleSymbolicName.length() + 1); + } + + if (!applicationContext.containsBean(beanName)) + throw new ArgeoException("No bean with name '" + beanName + "'"); + + this.bean = applicationContext.getBean(beanName); if (this.bean instanceof IExecutableExtension) { ((IExecutableExtension) this.bean).setInitializationData(config, propertyName, data);