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

后端 未结 4 896
自闭症患者
自闭症患者 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:05

    Annotations in Java programing language is a special form of metadata that can be embedded in Java source code. The use of annotations in Java language is introduced in Java 5.0 ie Java 5 provides metdata support at language level.

    In Spring, XML based configurations is the most popular configuration style.. Then annotation based configuration style came which enables users to configure beans inside the java source file itself. Spring framework provides different custom java5+ annotations. These annotations can be used in transactional demarcation, aop, JMX etc. There are core Spring Annotations, Spring MVC Annotations, AspectJ Annotations, JSR-250 Annotations, Testing Annotations etc. Both xml based configurations and Annotations have pros and cons. I would suggest mixing the two.

    The custom Spring annotations are framework specific. But you can write your own annotations also.

    The Core container module is the most important module which handles the basic principle of Dependency Injection and it's used in all other modules in the framework. Spring MVC is only a web MVC framework built on Spring's core functionality.

    You can go through Spring documentation and books like Spring in Action and Spring Recipes to get a good idea about the framework.

提交回复
热议问题