Home > front end >  How to inject dependencies in a class implementing Jobrunr ApplyStateFilter interface?
How to inject dependencies in a class implementing Jobrunr ApplyStateFilter interface?

Time:07-26

I am trying to implement a project using jobrunr. I have a use case where a service I have written should be triggered once the maximum retries are done for a job. I tried achieving the same using this answer as reference. The filter logic is triggered once a job fails but the dependency I include (which has my logic) is returning a null point exception(java.lang.NullPointerException: Cannot invoke "com.project.service.ScheduleHistoryService.someFunc()" because "this.service" is null). I am able to inject the same service file using @Autowire in my other components. What am I doing wrong here? I am using jobrunr version 5.1.4. Attached is a screenshot of the sample code:enter image description here

CodePudding user response:

Injecting services in the filters is only possible in the Pro version of JobRunr.

  • Related