Understanding the Technical Principles Behind Scala3 Library Bootstrapped Framework in Java Class Libraries

com.example.MyLibraryServiceImpl package com.example import scala.reflect.runtime.universe._ trait LibraryService { def doSomething(): Unit } class MyLibraryServiceImpl extends LibraryService { def doSomething(): Unit = { println("Doing something in MyLibraryServiceImpl.") } } object Main { def main(args: Array[String]): Unit = { val serviceName = "com.example.LibraryService" val serviceImpl = Class.forName(serviceName).newInstance().asInstanceOf[LibraryService] serviceImpl.doSomething() } }