In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you a few commonly used SpringBoot notes, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!
Several commonly used Notes on SpringBoot
(1) @ RestController and @ Controller specify a class as an annotation for the controller and explain the difference
(2) @ RequestMapping method-level mapping annotations, which are familiar to a partner who has used Spring MVC.
(3) @ EnableAutoConfiguration and @ SpringBootApplication are class-level annotations. Automatically guess the correct configuration of spring according to the jar of maven dependency. As long as spring-boot-starter-web dependency is introduced, Spring MVC and tomcat containers will be automatically configured by default.
(4) @ Configuration class-level annotation. Generally, this annotation is used to identify the class where the main method is located and to complete the initialization of the metadata bean.
(5) @ ComponentScan class-level annotation, which automatically scans and loads all Spring components, including Bean injection, and is generally used on the class where the main method resides
(6) @ ImportResource class-level annotations, and when we have to use a xml configuration, use @ ImportResource and @ Configuration to identify the class of this file resource.
(7) @ Autowired annotation, usually combined with @ ComponentScan annotation, to automatically inject a Service or Dao-level Bean
(8) @ Component class-level annotation, which is used to identify a component. For example, if I customize a filter, I need this annotation to identify Spring Boot correctly.
How does springboot manage transactions? Just write the @ transactional annotation, which is a method transaction in a method and a class transaction in a class.
The above are all the contents of this article "several commonly used Notes on SpringBoot". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.