IQSS / IQSS/dataverse

Suggestion: replace constructor/method params for beans with CDI call

Open
#10,774 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Code Infrastructure Type: Suggestion
Dominant language
Java
Stars
1.1k
Forks
564
Avg merge
2d 2h
Merged PRs (30d)
29

Description

Overview of the Suggestion
We have several places in the code (JSONParser, OREMap, ...) where we include persistent beans as constructor or method parameters (because these are POJO classes rather than beans so they can't just use @EJB to reference them. However, I recently ran across a couple places where
jakarta.enterprise.inject.spi.CDI.current().select(*Bean.class).get() is used to get an instance of one of our services. It seems like this is a cleaner approach, especially for cases where we're passing the service bean through multiple calls.

Are you thinking about creating a pull request for this issue?
Not in the near term - raising this as a possibility for others who might want to clean up a bit and to raise awareness that this might be the preferred approach for new code.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review JSONParser, OREMap, and the existing uses of jakarta.enterprise.inject.spi.CDI.current().select(...).get() to map where persistent beans are passed through constructors or methods. Before changing anything, establish the affected call chains and agree on the scope; done would be a defined, reviewed migration plan rather than a single localized edit.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.