'How to get ApplicationContext in Micronaut CLI application into Httpclient class?
I am running a Micronaut CLI application via Picocli runner wanted to use applicationContext for injecting/getting the bean during application execution.
@HttpRetryable
@Client("SERVICE_ID")
interface TestHttpClient {
}
@Inject
lateinit var applicationContext: ApplicationContext
private class AuthenticationFilter() : HttpClientFilter {
// calling appcontext here
println("appContext is Running " + appContext.isRunning)
}
But getting this error on the execution
kotlin.UninitializedPropertyAccessException: lateinit property applicationContext has not been initialized```
How this can be fixed ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
