This commit is contained in:
Lucio Lelii 2016-10-05 13:15:22 +00:00
parent a8cdc9e6de
commit 527ce352ed
2 changed files with 13 additions and 4 deletions

10
pom.xml
View File

@ -36,9 +36,15 @@
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.9-RC1</version>
<version>0.9.10</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-smartgears</artifactId>

View File

@ -10,6 +10,7 @@ import javax.servlet.annotation.WebListener;
import org.gcube.smartgears.annotations.ManagedBy;
import org.gcube.smartgears.context.application.ApplicationContext;
import org.reflections.Reflections;
import org.reflections.scanners.SubTypesScanner;
import org.reflections.scanners.TypeAnnotationsScanner;
import org.reflections.util.ClasspathHelper;
import org.reflections.util.ConfigurationBuilder;
@ -43,8 +44,10 @@ public class ContextListener implements ServletContextListener {
private void retrieveAndRegisterManagers(ApplicationContext context) {
Reflections reflection = new ConfigurationBuilder().addUrls(ClasspathHelper.forClassLoader()).setScanners(new TypeAnnotationsScanner()).build();
ConfigurationBuilder reflectionConf = new ConfigurationBuilder().addUrls(ClasspathHelper.forClassLoader()).setScanners(new TypeAnnotationsScanner(), new SubTypesScanner());
Reflections reflection = new Reflections(reflectionConf);
Set<Class<?>> toInitialize = reflection.getTypesAnnotatedWith(ManagedBy.class);
Set<Class<? extends ApplicationManager>> managers = new HashSet<Class<? extends ApplicationManager>>();
for (Class<?> initializer: toInitialize ){