Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Only scan requirement package for classes with Impl annotation #88

Merged
merged 1 commit into from
Jul 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.codeoverflow.chatoverflow.WithLogger
import org.codeoverflow.chatoverflow.connector.Connector
import org.reflections.Reflections
import org.reflections.scanners.{SubTypesScanner, TypeAnnotationsScanner}
import org.reflections.util.{ClasspathHelper, ConfigurationBuilder}
import org.reflections.util.{ClasspathHelper, ConfigurationBuilder, FilterBuilder}

import scala.collection.mutable
import scala.collection.mutable.ListBuffer
Expand Down Expand Up @@ -55,6 +55,8 @@ class TypeRegistry(requirementPackage: String) extends WithLogger {
// Use reflection magic to get all impl-annotated classes
val reflections: Reflections = new Reflections(new ConfigurationBuilder()
.setUrls(ClasspathHelper.forPackage(requirementPackage))
.filterInputsBy(new FilterBuilder()
.includePackage(requirementPackage))
.setScanners(new SubTypesScanner(), new TypeAnnotationsScanner()))
val classes = reflections.getTypesAnnotatedWith(classOf[Impl])

Expand Down