I'm developing the Java Web. Do you use Lombok in practice?

Asked 2 years ago, Updated 2 years ago, 86 views

We are developing the web with springs.

The company is only modifying the coat that the shooter gives me...

I'm going to study personally.

https://github.com/origoni/Spring-Blog

Looking at this coat, I can't run it right away in Eclipse and I need to install a plug-in called lombok.

Is this plug-in commonly used?

lombok java web eclipse spring

2022-09-21 23:23

4 Answers

I've seen a case where the company uses it in development work. I can't say it's all like that.

Lombok itself provides an annotation for simple mechanical production of code, such as getter/setter, toString, equals, and hashcode. In general, it is very convenient when the attribute (member name) changes frequently, so it is very helpful when developing it. In fact, the absence of Lombok does not interfere with program logic or functionality. However, I will have to work hard to make each of them.

The function itself works when compiling a Java source, automatically creating a member function that corresponds to that annotation to be reflected in the compilation results. However, you must use the Lombok plug-in when compiling the source code, so those who develop it with you must also use the Lombok plug-in.

To use in Eclipse, you can:


2022-09-21 23:23

This is especially common in projects with many Entity or Domain definitions. In the new project setting stage, I usually introduce ORM and do Domain setting first, so I always do it.

Although IDE's Code Generate feature is well-equipped to reduce the effectiveness, anyone can suggest the introduction of Lombok for projects that are not burdensome to add libraries/plug-ins. Sometimes I've seen developers who don't like or oppose Lombok, but I don't think I've seen any of them write proper equals() or hashCode() codes.


2022-09-21 23:23

I wrote it often. It is especially useful when member variables change frequently at the beginning of a project, but from some point on, there were inconveniences in refactoring or checking call hierarchy for getter/setter, so it was often removed except for @EqualsAndHashCode or @ToString.


2022-09-21 23:23

I saw it being used by one of the 50 innovative fintech companies in the world. It's okay to use it in practice, and there are more places to use it than I thought. This is because Java has little linguistic support, but it's already added to other languages, and I don't think there's an important reason not to use what Lombok does because he does what I have to do passively.

And the plug-in is only needed for development, and the software you made just needs to put the Lombok jar file into the library. This means that the deployment after development is complete is the same as any other library.


2022-09-21 23:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.