1. @Controller is the annotation of SpringMVC, which is used to process http requests;
2. The annotation added after @RestController Spring4 is a combined annotation of @Controller and @ResponseBody, which is used to return a json string;
3. The combination of @GetMapping @RequestMapping and Get request methods;
4. Combination of @PostMapping @RequestMapping and Get request methods;
5. The combination of @PutMapping @RequestMapping and the Put request method;
6. The combination of @DeleteMapping @RequestMapping and Delete request method;
7. When @Mapper SpringBoot inherits MyBatis, add @Mapper annotation to the Mapper interface
8. @MapperScan continues 7, you can also add @MapperScan("***.mapper") annotation package scan to the running main class
9. @EnableTransactionManagement uses annotations in the entry class to enable transactions
10. @Transactional adds annotations to the accessed database service method to start the transaction, which is the same as 9.
11. @PathVariable gets the data in the url and is used in SpringBoot to develop RESTFull. This annotation is the most important annotation to implement RESTFull
RESTFull is not a framework, but a style of Internet software architecture design. The interface designed based on this concept can be more concise and more hierarchical;
The term REST was coined by Roy Thomas Fielding in his PhD thesis in 2000;
For example, we want to access an http interface: http://localhost:80080/api/order?id=1021&status=1
Using RESTFull style, the http address is: http://localhost:80080/api/order/1021/1
@PostMapping receives and processes post requests
@PutMapping Receives requests in put mode, which can be replaced by PostMapping
@GetMapping receives and processes get requests
@DelectMapping Receives requests in the delect mode, which can be replaced by GetMapping
A demo to show the development of RESTFull
@GetMapping("/boot/user/{id}") public @ResponseBody Object user(@PathVariable("id") Integer id){ User user = new User(); user.setId(id); user.setName("张三"); return user ; }
12. @Component This annotation is from Spring, it is used when SpringBoot integrates Dubbo, it is used in Dubbo's interface implementation class, and it is used together with @Service. @Servcie is provided by Dubbo.
13. @SpringBootApplication is the entry main program for the Dubbo service provider.
14. @EnableDubboConfiguration and 13 are placed on the same main method to enable Dubbo's configuration support.
15. @Reference is used for Dubbo's consumers, that is, in the controller, it is Dubbo's annotation, which is used to refer to the remote Dubbo service
16. @Configuration Add the @Configuration annotation to the configuration class to mark this class as a configuration class for SpringBoot to scan.
17.@WebServlet(urlPatterns=""), use servlet in SpringBoot and use it on servlet.
18. @ServletComponentScan(basePackages="com.***.***"), used together with 17, this annotation is added on the main class of the main method, if there are multiple servlet classes, the annotation is @ServletComponentScan(basePackages= {"com.***.servlet","com.***.***"})
19. @WebFilter(urlPatterns="/*") Use filter in SpringBoot, that is, filter, which is used on servlet. Similarly, add @ServletComponentScan(basePackages="com.***.*** to the main method main class") ")annotation.
20. @Bean is equivalent to spring's xml configuration file
<bean id="***" class="org.springframework.boot.web.servlet.ServletRegistrationBean"> <property name="" value=""/> </bean>
The method name is equivalent to the bean's id
The return value of the method is equivalent to the class of the bean