title: Dagger Dependency Injection in main function
body: <p>I am calling a function in a class S3FileOperationsAdapter from the main function in my kotlin code. I am injecting the class S3FileOperationsAdapter in the main function file. So it looks like</p>
  <pre><code>class Runner {
      @set:Inject
      lateinit var s3FileOperationsAdapter: S3FileOperationsAdapter
  
      fun main(args: Array&lt;String&gt;) {
         s3FileOperationsAdapter.readFunction()
      }
  }
  </code></pre>
  <p>Now the issue is:</p>
  <ul>
  <li>When I try to run the above code, I get the error <code>Error: Main method is not static in class com.amazon.bram.sim.BatchJobRunner, please define the main method as:</code>. This is understandable.</li>
  </ul>
  <p>And we can only make a static function within an object in kotlin. So upon doing that, I cannot Inject the dependency, because <code>Dagger does not support injection into Kotlin objects</code>. So it feels like a deadlock.</p>
  <p>My question is, I want to inject the dependency in this file anyhow so that I can call the respective function. And I am calling this function from the &quot;fun main()&quot; in kotlin. How can I achieve this? Has anyone ever faced this before?</p>