What are annotations and how do they actually work for frameworks like Spring?

后端 未结 4 887
自闭症患者
自闭症患者 2020-12-03 07:14

I am new to Spring and now a days I hear a lot about Spring Framework. I have two sets of very specific questions:

Set No. 1:

  • What

4条回答
  •  抹茶落季
    2020-12-03 08:06

    Annotations were introduced in Java 5 http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html and are not Spring specific. In general, annotations allow you to add metadata to a class, method or variable. An annotation can be interpreted by the compiler (for example, the @Override annotation) or by a framework such as spring (for example, the @Component annotation).

    Spring has many different annotations, so you would need to be more specific about which annotations you have questions about. But Spring annotations can only be used within Spring, and other annotations can be used within other frameworks.

    For Set No 2 of questions, that should be opened as a second questions since it doesn't relate to the annotations.

提交回复
热议问题