i wondering if possible use @resource annotation on constructor.
my use case want wire final field called bar.
public class foo implements foobar { private final bar bar; @javax.annotation.resource(name="myname") public foo(bar bar) { this.bar = bar; } } i message @resource not allowed on location. there other way wire final field?
from source of @resource:
@target({type, field, method}) @retention(runtime) public @interface resource { //... } this line:
@target({type, field, method}) means annotation can placed on classes, fields , methods. constructor missing.
Comments
Post a Comment