title: How can I use Koin to inject in a @BeforeClass static method?
body: <p>I have an integration test that needs to call a REST service to get an access token one time before any subsequent tests are run. Before adding Koin to my project, I accomplished this in a static method annotated with <code>@BeforeClass</code> like so:</p>
  
  <pre><code>class PersonRepositoryIntegrationTest {
  
      companion object {
          private var _clientToken: String? = null
  
          @BeforeClass
          @JvmStatic
          fun setup() {
              _clientToken = AuthRepository().getClientToken()!!.accessToken
          }
      }
  
      @Test
      fun testCreatePerson() {
          PersonRepository().createPerson(_clientToken)
      }
  </code></pre>
  
  <p>AuthRepository and PersonRepository have additional dependencies that up until now were instantiated in their constructors. Now, I want to use Koin to resolve these dependencies by injecting the repositories:</p>
  
  <pre><code>class PersonRepositoryIntegrationTest : KoinTest {
  
      companion object {
          private val _authRepository by inject&lt;IAuthRepository&gt;()
          private val _personRepository by inject&lt;IPersonRepository&gt;()
          private var _clientToken: String? = null
  
          @BeforeClass
          @JvmStatic
          fun beforeClass() {
              startKoin(listOf(AppModule.appModule))
              _clientToken = _authRepository.getClientToken()!!.accessToken
          }
      }
  </code></pre>
  
  <p>When I try to use <code>inject</code> inside the companion object, the compiler gives an error:</p>
  
  <pre><code>Unresolved reference.
  None of the following candidates is applicable because of receiver type mismatch.
  
  * public inline fun &lt;reified T : Any&gt; KoinComponent.inject(name: String = ..., scope: Scope? = ..., noinline parameters: ParameterDefinition = ...): Lazy&lt;IAuthRepository&gt; defined in org.koin.standalone
  </code></pre>
  
  <p>Is there another way I can use Koin to inject my classes in a <code>@BeforeClass</code> static method like this?</p>