|Re: @Optional resource not being injected [message #1062933 is a reply to message #1062622]
||Tue, 11 June 2013 13:07
| Ezequiel Panepucci
Registered: June 2013
Here is the documentation for "@Optional" which I rely on:
The @Optional annotation can be applied to methods, fields, and parameters to mark them as optional for the dependency injection. Typically, if the injector is unable to find a value to inject, then injection will fail. However, if this annotation is specified, then:
for parameters: a null value will be injected;
for methods: the method calls will be skipped;
for fields: the values will not be injected.
which means that a method annotated with @Optional will be skipped not executed regardless of its existence in the context.
But in any case; I have a field annotated with @Optional and the problem is that the resource *is* available because I can inject it in a view from the same application context.
The reason I annotate this resource with @Optional is because this piece of code can execute in different applications, some of them have the resource in question but others do not have it.
I thought that @Optional was meant for this scenario...
Is there a chance this is a bug in RCP Juno?
I'll try the beta kepler later and see if that works.
Thanks for the message.
Powered by FUDForum
. Page generated in 0.02514 seconds