@javax.annotation.Resource: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 7: | Line 7: | ||
The @Resource annotation marks a resource that is needed by the application. This annotation may be applied to a component class, or to fields or methods of the component class. | The @Resource annotation marks a resource that is needed by the application. This annotation may be applied to a component class, or to fields or methods of the component class. | ||
When the annotation is applied to a field or method, the container will inject an instance of the requested resource into the application component when the component is initialized. | When the annotation is ''applied to a field or method'', the container will inject an instance of the requested resource into the application component when the component is initialized. If the annotation is ''applied to the component class'', the annotation declares a resource that the application will look up at runtime. | ||
If the annotation is applied to the component class, the annotation declares a resource that the application will look up at runtime. |
Revision as of 16:43, 4 April 2017
Internal
Overview
The @Resource annotation marks a resource that is needed by the application. This annotation may be applied to a component class, or to fields or methods of the component class.
When the annotation is applied to a field or method, the container will inject an instance of the requested resource into the application component when the component is initialized. If the annotation is applied to the component class, the annotation declares a resource that the application will look up at runtime.