Hello.
I came across this code and explanation from specs 9 chapter about @Context where it says about Injection, I came to the conclusion that I can not understand the idea of "Injection" and therefore I do not understand why this annotation.
Injection translates as "insert", "enter", I wrote a project in java core and created classes and based on them objects, in classes I entered data into primitive types or types of a certain class, transferred them to other classes and methods, and entered data into the database. In the transition to EE, annotations and the concepts of "Injection" appeared, which I did not deal with.
@GET @Produces{"text/plain"} public String listQueryParamNames(@Context UriInfo info) { StringBuilder buf = new StringBuilder(); for (String param: info.getQueryParameters().keySet()) { buf.append(param); buf.append("\n"); } return buf.toString(); There are annotations that are clear to me like:
@get @post @put @Delete @Path @PathParam @QueryParam , but @Context how much of what I read cannot understand, it is written that it is used for "Injection" in the Class field, or method, although this is what I did and without this annotation before I began to study EE.
- "Injection" I can not understand what it means and what is meant by this?
- I used to write parameters of methods only with the type, while reviewing this code, the abstract is added, for what? What does it add to the functionality or what does it affect?