Mybatis creation return object exception caused by Lombok’s @Builder annotation

Mybatis creation return object exception caused by Lombok’s @Builder annotation **Conclusion:** After using the Bbuilder annotation, a fully parameterized constructor will be produced based on the current class (excluding the attributes of the parent class). Mybaitis will cause many strange exceptions when it attributes the returned data, so it is best not to use it. […]

Spring’s @FieldDefaults and @Data: Lombok annotations for cleaner code

Introduction As Java developers, we often find ourselves stuck in boilerplate code. Accessor methods, modifier methods, constructors, equals(), hashCode(), and toString() are essential, but take up a lot of space and distract from the core logic of the application. The Spring framework is widely used for building enterprise applications and is a fan of reducing […]

[Spring] DI dependency injection, Lombok and SpEL

Article directory 1.What is DI dependency injection 2. set method injection 3. ref attribute 4. Parametric constructor injection 5. Lombok 6.SpEL 1. What is DI dependency injection Dependency Injection (DI) is a design pattern and one of the core concepts of the Spring framework. The basic idea is to transfer the dependencies between the various […]

When lombok and mapstruct are used at the same time; the get and set methods of the pojo class fail to be generated, and the implementation class of mapstruct fails to be generated. It is just a new object.

Project scenario: When lombok and mapstruct are used at the same time; the get and set methods of the pojo class fail to be generated, and the implementation class of mapstruct fails to be generated. It is just a new object. Project related background: In recent work, I have been converting objects related to DTO, […]

Automatic camel case mapping; use of Mybatis-Plus; junit unit testing; Lombok automatically generates get set of entity classes with no parameters and parameters; detailed cases are attached! !

Introduction to MybatisPlus Official website: https://baomidou.com/ MyBatis-Plus (referred to as MP) is an enhancement tool for MyBatis. Based on MyBatis, it only enhances without making changes. It is created to simplify development and improve efficiency (see the official website for details) Mybatis automatic camel case mapping Implementation steps: The database follows the database naming rules, […]

Lombok + Swagger2 +Jackson The second letter of the attribute is uppercase, and the second letter of the field after serialization is lowercase

Article directory 1. Problem Overview 2. Cause analysis: 1. Overview of the problem The original FastJson converter used in the SpringBoot project, with Swagger2 + lombok serialization, the field case is normal, but when it is replaced with fastJson, if the second letter in the original entity is capitalized, the fields returned in the swagger […]

The correct posture for using Lombok in DDD projects

# Programmers who have written Java know that the syntax of Java is relatively cumbersome. Various getters, setters, equals() and hashCode() are flying all over the sky. Sometimes the real business logic code is completely submerged, making it difficult for people to read the code. Intuitively understand the functions completed by the code. So we […]

Lombok-A must-have tool for lazy people

Objective of this article Understand Lombok, install Lombok, and use Lombok Prerequisite skills: IDEA, Maven 1. Understanding Lombok Official website explanation Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java. Never write another getter or equals method again, with one annotation your class has a […]

Lombok’s understatement

What is Lombok? A brief introduction: Lombok is a development tool library for the Java language. In object-oriented programming languages, we often need to construct a large number of POJO objects and maintain corresponding get set methods. I believe that developers who have used Java can all understand the pain of repeatedly writing get set […]

Lombok uses @Data and @Builder at the same time. Have you fallen into this trap?

Problem Background Lombok uses @Data and @Builder at the same time, and an error occurs when building a parameterless constructor! Compilation fails. As shown below: Lombok @Data and @Builder analyze usage separately Lombok uses @Data to create parameter constructs and getter/setter methods for all properties of the class. It can simplify the development of our […]