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
Error "Missing @Injectable for field" with @Resource annotation #359
Comments
The @Injectable field should match the name of the target @resource ("test"). So, name it "test". |
@rliesenfeld in my project I use names like "subname1.subname2.name" and in this case I cannot name field with dots. |
The names need to match, otherwise it's not possible to support a scenario where multiple @resource's of the same type are injected into a given object. Name matching can be made more flexible, though. I am thinking of two possible solutions, when given a resource name composed of multiple parts separated by special characters such as "." (dot) or "-" (hyphen):
Which solution would you prefer? |
I am tech lead of the project so let me answer. How possible to support a scenario where multiple |
Thanks for your suggestions. But if we will use solution with underscore we will face with codestyle problems. In this case can we use camelcase solution? Something like this: |
Good catch, I didn't release that. Camelcase is definitely better |
Ok, camel case can be supported too. |
I use JMockit 1.28 (tried 1.29)
Java 1.8.92
I work with
@Resource
annotation. But withname
value my tests not working. Without it tests work fine.Console output:
Also if using
@Autowired
with@Qualifier
tests work fine.Test case is here: jmockit-check.zip
I use something like this as workaround:
Might be that is a bug, maybe I 'm doing something wrong. Thank you in advance and hope for your help.
Thank you,
Alex
The text was updated successfully, but these errors were encountered: