giiita / refuel

Lightweight dependency injection engine and DI-driven tools.
Apache License 2.0
22 stars 1 forks source link

Some DIs do not work unless it is in fullscan mode when running from SBT #16

Closed giiita closed 5 years ago

giiita commented 5 years ago

Basically it is supposed to be executed in a build with fatjar configuration. Therefore, when running with java -jar, you can specify the class that inheritedAutoInject[T]from the default class loader. Also, even when launched in the IDE, since the compiled * .class group is referenced from the class loader, automatic DI can be solved.

However, when starting with sbt 1 or more, since it depends on the local ivy cache list to refer to the dependent jar and add it to the class path and start it, In order to solve automatic DI, all jars must be solved, and it takes a very long time to start up.

https://github.com/giiita/scaladia/blob/master/scaladia-container-core/src/main/scala/com/giitan/box/ScaladiaClassLoader.scala

giiita commented 5 years ago

As a countermeasure to this problem, we have modified from v1.6.0 to load all classpaths other than jdk by default by default. It is recommended to optimize it by setting the whitelist of the archive to be loaded, since it affects the performance when starting JVM. Permanent correspondence is under consideration separately.

giiita commented 5 years ago

Fixed in 2.1.0 or later