Spring common annotations-may be updated continuously-learn while remember

table of Contents

1. Overall

2. Summary


1. Overall

Comment effect
 @controller controller Inject service, Controller layer 
 @service service Data injection, DAO layer
 @repository Data access, DAO layer
 @component  Ordinary POJO is instantiated into the Spring container

2. Summary

  • The annotations under the four categories correspond to their applicable functions;
  • There are corresponding small function annotations under each class, which will be recorded later;

Reference: https://www.cnblogs.com/javastack/archive/2020/07/23/13366510.html

 

The following is a preliminary understanding of small function notes

Annotation categories Small notes Corresponding to small functions Reference
@controller controller @RequestMapping Processing request address mapping https://blog.csdn.net/qq_30507287/article/details/80839627
@responsebody

The function of the @responseBody annotation is to convert the object returned by the controller method into a specified format through an appropriate converter, and then write it to the body area of ​​the response object.

 

Usually used to return JSON data or XML data.

 

It should be noted that after using this annotation, the processor will not be tried again, but the data will be directly written to the input stream. Its effect is equivalent to outputting the data in the specified format through the response object.

https://www.cnblogs.com/mengtaoadmin/p/11184014.html
@Autowired Inject a defined bean https://blog.csdn.net/topdeveloperr/article/details/87971446
     
       
       
       
       
       
       
       

 

Guess you like

Origin blog.csdn.net/Longtermevolution/article/details/107907380