Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discover implementation of fields with interface type #152

Open
serprime opened this issue Oct 9, 2019 · 0 comments
Open

Discover implementation of fields with interface type #152

serprime opened this issue Oct 9, 2019 · 0 comments

Comments

@serprime
Copy link
Contributor

serprime commented Oct 9, 2019

When using cdi-unit the implementation classes are not discovered by default.

In our code base we have a guide line to use interfaces for all service classes.
All fields use the interface type.
This means, we need to manually add all required classes via annotations.
That is cumbersome and not useful.

Can we have a new feature, that cdi-unit finds and injects the implementations of interfaces used in field types?

Example:

class ServiceImpl {
  @Inject private OtherService otherService;
}

interface OtherService {}

class OtherServiceImpl implements OtherService {
}

So when testing ServiceImpl I expect OtherServiceImpl to be injected in ServiceImpl.otherService.

Sould this be enabled via annotation, or can this be the new default?
Did anybody else have this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant