In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to integrate lombok.jar in Springboot". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to integrate lombok.jar in Springboot.
Introduction
Spring Boot is a very efficient development framework, lombok is a set of code template solution, will greatly improve the efficiency of development, here is introduced to you to use.
Lombok wants to solve a large number of Getter/Setter methods in our entity Bean, as well as toString, hashCode and so on may not be used, but sometimes still need to be copied in order to facilitate the use of methods; after the use of Lombok, it will automatically help you to achieve code generation, note that it is in the process of running, to help you automatically generate. That is, it will greatly reduce the total amount of your code.
First, add the lombok.jar dependency in the pom.xml file of the project. You only need to fill in groupid and artifactid. The version and scope have been defined in the parent project boot project.
Org.projectlombok lombok
Then download lombok.jar and download it in order to install lombok into ide and run it in cmd.
I run directly to the download directory of lombok, and I can also run it directly in other directories. I need to execute the command: download directory of java-jar lombok.jar + lombok.jar
Then your IDE installation screen will pop up, and if you have more than one IDE, you will have more than one choice, choose the version of IDE you are using. Note that this is the way eclipse is installed, and ldea does not seem to work.
Finally, go to your IDE installation directory to check the ini file. If you have the-javaagent:lombok.jar code, it means that the installation has been successful.
Introduction of common notes
@ Getter/ @ Setter: you can act on a class and a property, and if you put it on a class, you will generate a Getter/Setter method for all non-static (non-static) properties, and if you put it on a property, you will generate a Getter/Setter method for that property. And you can specify the access level of the Getter/Setter method.
EqualsAndHashCode: by default, all non-transient (non-transient) and non-static (non-static) fields are used to generate equals and hascode methods, or you can specify which properties to use. @ ToString generates the toString method, which, by default, outputs the class name and all attributes, which are output sequentially, separated by commas.
@ NoArgsConstructor, @ RequiredArgsConstructor and @ AllArgsConstructor: no parameter constructor, partial parameter constructor, full parameter constructor
Data: contains @ ToString, @ EqualsAndHashCode, @ Getter for all attributes, and a combination of @ Setter and @ RequiredArgsConstructor for all non-final attributes. In general, this annotation is basically sufficient.
@ Budilder: it can be initialized in Builder mode.
Slf4j: equivalent to: private final Logger logger = LoggerFactory.getLogger (XXX.class); it couldn't get any better! Generally used on other java classes
Thank you for reading, the above is the content of "how to integrate lombok.jar in Springboot". After the study of this article, I believe you have a deeper understanding of how to integrate lombok.jar in Springboot, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.