Home

Tuesday, July 25, 2023

Lombok Installation in Spring Suite Tool And Advantages and DisAdvantages of Using Lombok

What is Lombok?

Lombok is an open source library. You don’t need to pay for it to use.


1.
2.

When using Lombok, all that you need is, technically we need to configure the dependency to the required libraries.You need to configure Lomobk in pom.xml if it is maven based project. Maven will automatically downdoad jar for your project. Add @data annotation to our User pojo class to generate getter and setter for our properties.

Our IDE is still not understand what these @Data annotations and will keep complaining about those missing getters and setters.

We can fix this issue in different ways:
1. You can install from eclipse marketplace if it is available. Or
2. you can get plugin from lombok website for your IDE and install it.
3. Or another way is go to browser. Enter lombok jar download. Here you can latest version


Copy and move downloaded jar file to your STS installation folder here or your favorite folder. Copy the path of your lombok jar and open this ini file in your favorite ide either in notepad or notepad ++.
You have to include this lombok path all the way down here using javaagent like below .
-javaagent:E:\software\STS_setup\sts-4.18.1.RELEASE\lombok.jar

Now go to our IDE. File click exit. We will now start our ide again. Double click this spring tool suite application icon.
Now remove @data annotation and enter again. Now you can see our IDE is not complaining.
We saw how to install lombok on our STS IDE.


Reference Video for Lombok Installation In Spring Suite Tool - Advantages and Disadvantages of using Lombok::
Now we will see advantages and disadvantages of using lombok in our project.

Advantages

* Lombok saves time and money. Think about all the paid time your team spends writing getters and setters, renaming them when renaming a variable, etc. This will take lot of time and money.

* Lombok make your code cleaner and easier to read.



Disadvantages

* Debugging Lombok code is difficult:
You don't need to debug getter, setter as it does not change much between classes and usually does very simple tasks, such as setting variable values. But if you do need to debug Lombok code, then you will have difficulties doing so. You have to delomboke means you have to remove your lombok configuration.

* Generated getter and setter won't display. Suppose if you are using SonarQube in your Enterprise Application, then it leads to Sonar Violation, Since your code will be without getters and setters. This is the big disadvantege of using Lombok.


Summary:

We saw how to install Lombok open source plugin in Spring Suite Tool and also we saw what are the advantages and disadvantages of using lombok in our Enterprise Application.

No comments:

Post a Comment

Spring Boot Rest API -Exception handling

Client is sending the request. Getting response. If everything is okay. Then we are good. But if something fails t...