1: startup class

The basic pattern is as follows

@SpringBootApplication
public class ServiceEduApplication {
    public static void main(String[] args) { SpringApplication.run(ServiceEduApplication.class,args); }}Copy the code

2: @mapperscan () annotation

2.1: @ Mapper

The @mapper () interface is half over the database add, delete, change, and query interface. With @mapper, eventually Mybatis will have an interceptor that automatically generates dynamic proxy classes for @Mapper annotated interfaces. You can see this in the source code in the MapperRegistry class.

2.2: @ MapperScan annotation

The @mapper annotation is for a class by class, which is equivalent to a mapper.xml file by file. It was too cumbersome to use @Mapper interface by interface, so @Mapperscan was used. MapperScan configures one or more package paths, automatically scans the classes under these package paths, and automatically generates proxy classes for them.

3:@ComponentScan

@ComponentScan is used for classes or interfaces to specify a scan path. Spring automatically assembles classes in a specified path with specified annotations into the bean container. Annotations that will be auto-assembled include @Controller, @Service, @Component, @repository, and so on.

4:@configuration

From Spring3.0, @Configuration is used to define Configuration classes that can replace XML Configuration files. The annotated classes contain one or more @Bean-annotated methods that are used to build Bean definitions and initialize the Spring container.

5:@RequestBody

@requestBody is used to receive data from the JSON string passed from the front end to the back end. If @RequestBody is used to receive data, the front end cannot submit data in GET mode. Instead, it submits data in POST mode. @requestBody and @RequestParam() can be used together in the same receiving method on the back end. @RequestBody can have at most one and @RequestParam() can have more than one.