1. @ SpringBootApplication
This annotation is equivalent to indicating that the class is a switch, and three annotations are combined to directly start the class with the annotation when the project is started
@configuration indicates that this class can use the Spring IoC container as the source of the bean definition. @bean tells the Spring container that the annotation method with @bean will return an object. Your mom told you to get a girlfriend at school.
EnableAutoConfiguration can automatically configure the spring context, try to guess and configure the bean class you want, usually automatically configure according to your classpath and your bean definition. You will recommend your favorite girl (bean) to you according to your preferences on XXX software.
@ComponentScan automatically scans all classes labeled with @Component and registers them as beans, including @Service,@Repository, and @Controller. When you watch anime, anything you like (labeled Component) is your girlfriend (bean).
2, the @autowired
Auto injection Automatically inject values into the entity class that you define
3, @ RequestMapping
Specific method of use
@requestMapping (value = “/CRUD”, method = {requestmethod.get, requestmethod.post})
@getMapping to process GET requests
PostMapping: Processes POST requests
@putMapping to process put requests
DeleteMapping provides resultful support for handling DELETE requests
4, @ ResponseBody
Convert the returned object into a JSON string that is easy to read (digitize your girlfriend) @requestBody This method can be used on fields
5, @ CrossOrigin
Can be used for cross-domain access specific use method: @crossorigin (” http://localhost:8080 “) the other party to change localhost to your IP address to access
6. @mapper and @mapperscan
1. Add @mapper to the interface class. After compiling, the corresponding interface implementation class will be generated.
@mapper public interface userService {// code block}Copy the code
MapperScan specifies the package in which the interface is to be converted into the implementation class. Then all interfaces under the package will generate the corresponding implementation class after compilation.
7, @ Bean
The @bean annotation is used to tell the method to generate a Bean object, which is then handed over to Spring to manage
8, @ Controller
Tag @Controller on a class for the control layer. With the @requestMapping annotation, you can define multiple interfaces in a class, making it more flexible to use
9, @ Api
Swagger is currently the best open source project generated by Restful API documents. The Swagger – Spring project achieves seamless integration with SpingMVC framework to facilitate the generation of Spring Restful interface documents.
10, @ ConfigurationProperties
We want to read the configuration file and automatically encapsulate it into an entity class so that we can use it in our code a lot easier, so we can use @ConfigurationProperties, which automatically encapsulates the same configuration into an entity class
11, @ PropertySource
Load the specified properties file (*.properties) into Spring’s Environment. Can be used with @Value and @ConfigurationProperties. ConfigurationProperties(prefix = “audience”) @propertysource (” classpath:jwt.properties “)
12, @ the value
Value dynamically injects an external Value into a Bean, in the following cases:
Injecting normal strings
Inject operating system properties
Injected expression result
Inject additional Bean properties
Inject the attribute another of the beanInject object
Injecting file resources Injecting URL resources
13, @ Component
@Component can annotate other class annotations ???? Excuse me??
14, @ the Select @ update @ insert @ delate
Annotations for SQL statements
The specific use
@select (” Select * from table name “)
@delete (” Delete from table where field name =#{value} “) the other two are similar
15, @ param
Param annotates a single attribute (the one I touched on)
Public User selectUser(@param(” userName “) String name,@param(” userpassword “) String password); @param annotates JavaBean objects
Public List getUserInformation(@param (” user “) user user);
16, @ Documented @ Retention @ Target
1.@Target({ElementType.TYPE})
@target is used to indicate the scope of the annotation, beyond which an error will be reported at compile time
2.@Retention(RetentionPolicy.RUNTIME)
@Retention defines how long this Annotation is retained
@retenrion indicates by RetebtionPolicy the level at which the annotation information needs to be saved, which is used to describe the lifecycle of the annotation (i.e., the extent to which the described annotation is valid)
3.@Documented Documented indicates that this annotation is Documented by Javadoc, and by default there is a similar documenting tool. If a type declaration is annotated and documented, its annotations become part of the public API