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

Find Bean Classes In Inherited '@Inject'-ed Fields #114

Closed
philippkunz opened this issue Jan 8, 2021 · 0 comments
Closed

Find Bean Classes In Inherited '@Inject'-ed Fields #114

philippkunz opened this issue Jan 8, 2021 · 0 comments

Comments

@philippkunz
Copy link
Contributor

I wondered why I had to specify @AddBeanClass with a class the same test inherited an injected field of that type. The bean class would have been found and added automatically if the injected field would have been on the test class itself as opposed to inherited. Weld also makes no such difference on whether injected fields are inherited or not so I figure weld-junit should follow the same rules with @EnableAutoWeld mode as well.

My guess is that there was an error in ClassScanning's method formerly named findAnnotatedFields and now renamed to findAnnotatedDeclaredFields having called getDeclaredFields which excludes inherited fields but the name of that method formerly named findAnnotatedFields did not reflect this restriction and was missed where it is used in scanForRequiredBeanClasses.

Producers, however, are not inherited, see https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#member_level_inheritance.

philippkunz added a commit to philippkunz/weld-junit that referenced this issue Jan 8, 2021
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