quarkiverse / quarkus-jberet

Quarkus Extension for Batch Applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to activate batch custom scopes

luca-bassoricci opened this issue · comments

I'm trying to activate a bean annotated with @JobScoped but this annotation is ignored during deployment phase (bean is not registered at all)

@JobScoped
@Named
public class MyDTO {...}

@Dependent
@Named
public class MyBatchlet implement Batchlet {
  @Inject MyDTO jobScopedInstance;
}

results is a deployment error due to unresolvable injection point.
Using a @Produces will make compilation passing the deployment phase, but during runtime the jobScopedField is managed as a @Dependent scoped bean.

public class ObjectProducer
{
	@Produces
	@JobScoped
	@Named("jobscoped")
	MyDTO jobScopedField = new MyDTO();

JBeret registers its custom scopes using service loader via BatchCDIExtension; I suppose the same should be done during deployment.
I attached a reproducer; remove comments from ObjectProducer class to let the (failing) test run.

Best regards
Luca Basso Ricci
quarkus-jberet-scope-problem.zip

Opened PR #123