Annotation Type JobScope


  • @Scope(value="job",
           proxyMode=TARGET_CLASS)
    @Retention(RUNTIME)
    @Documented
    public @interface JobScope

    Convenient annotation for job scoped beans that defaults the proxy mode, so that it doesn't have to be specified explicitly on every bean definition. Use this on any @Bean that needs to inject @Values from the job context, and any bean that needs to share a lifecycle with a job execution (e.g. an JobExecutionListener). E.g.

     @Bean
     @JobScope
     protected Callable<String> value(@Value("#{jobExecution.jobInstance.jobName}")
     final String value) {
            return new SimpleCallable(value);
     }
     

    Marking a @Bean as @JobScope is equivalent to marking it as @Scope(value="job", proxyMode=TARGET_CLASS)

    Since:
    3.0.1
    Author:
    Michael Minella