使用@Data、@Builder的注意点

简介: 使用@Data、@Builder的注意点

使用@Data注解会成get()和set()方法以及无参构造器。
使用@Builder将会帮助我们成全属性的构造法。
但是如果同时使@Data和@Builder的话,参构造法会被干掉。
解决方案:

  1. 可以在无参构造方法上加@Tolerate注解
    @Tolerate

    public AgentVO() {
    }

2.直接使用无参构造器+有参构造器的方式,@RequiredArgsConstructor 来构建有参,@NoArgsConstructor来构建无参构造器

@Data
@RequiredArgsConstructor
@NoArgsConstructor
目录
相关文章
|
18天前
Cannot load keys from store: class path resource
Cannot load keys from store: class path resource
11 0
|
5月前
|
应用服务中间件 数据安全/隐私保护 容器
websphere Error 404:SRVE0190E: File not found: index.action
websphere Error 404:SRVE0190E: File not found: index.action
org.activiti.engine.ActivitiException: Couldn't deserialize object in variable 'application'
org.activiti.engine.ActivitiException: Couldn't deserialize object in variable 'application'
|
JavaScript
Object.assign(this.$data, this.$options.data())-vue清空数据
Object.assign(target,...source)是es6新增的方法,可以合并对象,用于将所有可枚举属性的值从一个或多个源对象复制到目标对象,它将返回目标对象,target:目标对象,source:源对象,通过Object.assign方法,把source合并给target,如果目标对象中的属性名与源对象中的属性名相同时,则属性将被源对象中的属性覆盖,然后返回target对象;
151 0
Could not initialize English chunker/Could not load file from classpath: ‘/en-token.bin‘
Could not initialize English chunker/Could not load file from classpath: ‘/en-token.bin‘
83 0
Lombok - new Object & Object.builder.build 默认值区别?
Lombok - new Object & Object.builder.build 默认值区别?
101 0
|
开发工具 Android开发
解决Error:Could not determine the class-path for interface com.android.builder.model.AndroidProject.
解决Error:Could not determine the class-path for interface com.android.builder.model.AndroidProject.
164 0
解决Error:Could not determine the class-path for interface com.android.builder.model.AndroidProject.
How to render S4 Code List extension field into CRM WebUI product search view
This question is asked by Wade. Suppose I have created one extension field in S4 with type CodeList which contains all possible queue type supported by JDK. This extension field must be exposed to CRM Product Search WebUI. POC is done in X3C/504:
How to render S4 Code List extension field into CRM WebUI product search view
How to create CDS view to return Service order item detail data
You are asked to create a CDS view which must return the following information of Service order line item.
118 0
How to create CDS view to return Service order item detail data