Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jakartabatch-dev] CDI based job instantiation

All,

Not sure if this is the right list, but given my current experience, a batch job has some but not all capabilities of CDI injection at its disposal.

@Named
public class ExampleBatchlet extends AbstractBatchlet {
    @Inject
    private ExampleService service;

    @Override
    public String process() {
        service.doSomething(); // <-- NullPointerException
    }
}

@ApplicationScoped
public class ExampleService {
    public void doSomething() {}
}

This should IMO work, but my Jakarta Batch implementation, jberet, only injects artifacts that are JobContext, StepContext or BatchProperty [1]. 

Now this can be a bug in JBeret, or a bug in the specification, where it doesn't explicitly require full injectability of CDI beans. (The factory also doesn't take into account setter and constructor based injection).

Martijn


--
Become a Wicket expert, learn from the best: http://wicketinaction.com

Back to the top