Spring Integration
Dependency Injection via Spring
As of Obsidian 2.2.0, Obsidian has greatly improved the integration with your Spring dependency injection container. Obsidian does not include any Spring libraries and will defer to the version and libraries you include with your application. It supports versions of Spring from 2.5 onward.
Obsidian uses the @Component and any Spring or custom extensions of those annotations as a basis for knowing which job implementations (either SchedulableJob implementations or Obsidian Annotation jobs) should be retrieved from the Spring context. Even if you are not using Spring annotations to wire your classes, you will need to add the annotation to your job classes to serve as a Marker to Obsidian.
You will also need to ensure Obsidian's ApplicationContextAware implementation is known to Spring. If you are using Spring's scanning, you can use the following approach to add an additional package to your configuration:
<context:component-scan base-package="com.my.package.scan.base, com.carfey.ops.job.di"/>
Another option is to extend our com.carfey.ops.job.di.SpringContextAware class with a do nothing extension class in one of your currently scanned packages.
If you are not using scanning, simply ensure you wire in our com.carfey.ops.job.di.SpringContextAware class.
If you have multiple instances of a given bean type in your Spring context, please ensure you use the value="" when you annotate your job with @Component or its specializations as this is how Obsidian will uniquely identify the job within the Spring context.