Quarkus Command line Application #24116
-
Hello Everyone, I am developing an Quarkus CLI application, so that I can run it on the AWS Batch or AWS Lambda inside a container todo some processing. In my application, I am using command pattern. class DoHeavyWork {
@Inject Logger logger;
@S3Client s3Client
public DoHeavyWork(String s3FilePath){
this.s3FilePath=s3FilePath;
}
public void execute(){
logger.info() -> Throws NULL Pointer Exception.
}
}
In my build.gradle, I am using: Picoli extension. Now, when I am launching the command like: This is throwing an NPE saying logger is null. Bean injection is not working because, I am creating a new class with Is there a way to do this???? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
No. By using new you are not making it possible for any framework to do injection. |
Beta Was this translation helpful? Give feedback.
-
I have found a way to get the CDI classes by using the following code: |
Beta Was this translation helpful? Give feedback.
I have found a way to get the CDI classes by using the following code:
CDI.current().select(BlobReaderFactory.class).get();