Lombok

Warning equals/hashCode on @Data annotation lombok with inheritance

梦想与她 提交于 2019-11-29 23:28:11
I have a entity which inherits from other. On other hand, I'm using lombok project to reduce boilerplate code, so I put @Data annotation. The annotation @Data with inheritance produces the next warning: Generating equals/hashCode implementation but without a call to superclass, even though this class does not extend java.lang.Object. If this is intentional, add @EqualsAndHashCode(callSuper=false) to your type. Is it advisable to add annotation @EqualsAndHashCode (callSuper = true) or @EqualsAndHashCode (callSuper = false) ? If it is not added, Which one is it callSuper=false or callSuper=true

多线程售票

丶灬走出姿态 提交于 2019-11-29 21:13:23
多线程售票 多线程操作资源类 创建启动线程的写法 public Thread(Runnable target, String name).start() 线程的 6 种状态,线程调用 start 方法后不会立即执行,而是要等待空闲 CPU 的调度 使用 ReentrantLock 保证资源类的安全 package com.zbiti.juc; import lombok.extern.slf4j.Slf4j; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; //多线程操作资源类 3个售票员 操作 50张票 public class SaleTicket { public static void main(String[] args) throws InterruptedException { Ticket ticket = new Ticket(); new Thread(()->{ for(int i=0;i<40;i++){ ticket.sale(); } },"AA").start(); new Thread(()->{ for(int i=0;i<40;i++){

多线程售票

冷暖自知 提交于 2019-11-29 21:05:42
多线程售票 多线程操作资源类 创建启动线程的写法 public Thread(Runnable target, String name).start() 线程的 6 种状态,线程调用 start 方法后不会立即执行,而是要等待空闲 CPU 的调度 使用 ReentrantLock 保证资源类的安全 package com.zbiti.juc; import lombok.extern.slf4j.Slf4j; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; //多线程操作资源类 3个售票员 操作 50张票 public class SaleTicket { public static void main(String[] args) throws InterruptedException { Ticket ticket = new Ticket(); new Thread(()->{ for(int i=0;i<40;i++){ ticket.sale(); } },"AA").start(); new Thread(()->{ for(int i=0;i<40;i++){

IntelliJ Idea doesn't recognize Lombok's annotations [duplicate]

我的梦境 提交于 2019-11-29 18:52:21
This question already has an answer here: Can't compile project when I'm using Lombok under IntelliJ IDEA 24 answers I'm trying to introduce Lombok annotations into a Maven Java project in IntelliJ IDEA and followed the steps here and here . @Data annotation (for one) is not being recognized: Here's the relevant Maven stanza: <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.16.18</version> </dependency> </dependencies> I'm on Idea 2017.3.2 CE. I tried the solution mentioned here , it doesn't work: Doing File | Invalidate Caches & Restart didn't help.

Lombok not working with STS

可紊 提交于 2019-11-29 18:11:30
问题 Although I love lombok, it gives too much problems while configuring sometimes, specially in Linux. When I was trying to install it, I was getting the following error: I tried to set it up manually,as suggested here https://github.com/rzwitserloot/lombok/issues/95 but that didn't work out either. Any suggestions? 回答1: I have update the same on the following link. Lombok not generating getter and setter STS 回答2: For the STS on Mac OSX, choose the .ini file, not the .exe file . This is the path

编码习惯之Controller规范

匆匆过客 提交于 2019-11-29 16:10:49
第一篇文章中,我贴了2段代码,第一个是原生态的,第2段是我指定了接口定义规范,使用AOP技术之后最终交付的代码,从15行到一行,自己感受一下。今天来说说大家关注的AOP如何实现。 先说说Controller规范,主要的内容是就是接口定义里面的内容,你只要遵循里面的规范,controller就问题不大,除了这些,还有另外的几点: 所有函数返回统一的ResultBean/PageResultBean格式 原因见我的接口定义这个贴。没有统一格式,AOP无法玩。 ResultBean/PageResultBean是controller专用的,不允许往后传! Controller做参数格式的转换,不允许把json,map这类对象传到services去,也不允许services返回json、map。 一般情况下!写过代码都知道,map,json这种格式灵活,但是可读性差,如果放业务数据,每次阅读起来都比较困难。定义一个bean看着工作量多了,但代码清晰多了。 参数中一般情况不允许出现Request,Response这些对象 主要是可读性问题。一般情况下。 不需要打印日志 日志在AOP里面会打印,而且我的建议是大部分日志在Services这层打印。 规范里面大部分是 不要做的项多,要做的比较少,落地比较容易。 ResultBean定义带泛型,使用了lombok。 @Data public

How to set up compile library in android studio. LOMBOK

蓝咒 提交于 2019-11-29 12:41:39
问题 Help me to set up comile dependencies in Android Studio in build.gradle. I mean that they not include into final APK. this build.gradle works fine but i don't need lombok library in apk in runtime; apply plugin: 'android' android { compileSdkVersion 19 buildToolsVersion "19.0.0" defaultConfig { minSdkVersion 10 targetSdkVersion 16 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } }

Lombok 1.18.0 and Jackson 2.9.6 not working together

断了今生、忘了曾经 提交于 2019-11-29 12:15:28
问题 The deserialization is failing after the update. I updated my micro-service from Spring 1.5.10.RELEASE to Spring 2.0.3.RELEASE and also updated the lombok from 1.16.14 to 1.18.0 and jackson-datatype-jsr310 from 2.9.4 to 2.9.6 . The JSON string - {"heading":"Validation failed","detail":"field must not be null"} The Class - @Data @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class ErrorDetail { private final String heading; private final String

IDEA NICE PLUGINS

风格不统一 提交于 2019-11-29 12:06:33
IDEA插件,内容来源于各个网络内容的综合选取,各插件的使用方式和功能都可以在setting->plugins里面找到插件看介绍或者自行百度吧 1. activate-power-mode 和 Power mode II 根据Atom的插件activate-power-mode的效果移植到IDEA上,写代码的时候有特效,整个屏幕都在抖动,activate-power-mode是白的的,Power mode II色彩更酷炫点,个人感觉除了装X没啥卵用(主要是我TM电脑带不动啊,操蛋。。。)。代码特效如图: 2.Background Image Plus + idea背景修改插件,让你的idea与众不同,可以设置自己喜欢的图片作为code背景。 安装成功之后重启,菜单栏的VIew标签>点击Set Background Image(没安装插件是没有这个标签的),在弹框中路由选择到本地图片,点击OK即可。(图片来源于网络,我TM有点懒,不想去改,因为原版黑色很骚气。) 3.Grep console 自定义日志颜色,idea控制台可以彩色显示各种级别的log,安装完成后,在console中右键就能打开,可以选择指定的内容添加高亮,显示样式。 也可以设置不同的日志级别的显示样式,等操作。(其实就是指定关键字设置而已,跟选择关键词添加高亮效果是一样的,只不过日志级别这种它给你预设了而已

Eclipse Lombok annotations not compiled… Why?

做~自己de王妃 提交于 2019-11-29 10:55:36
I have a problem with my project. It is an Spring CRUD RestFul API that expose services witch are providing Json datas. I use JDK-7, Eclipse-Neon and Maven to code, build and the project is deployed into a JBossEAP 6.4 server. Every thing is working well, the services are responding correctly. So I decide to add Lombok, to reduce the boiler code and improve the readability of the code. By the way I used Lombok on an another project before and is worked fine. Here is my problem, after including Lombok : - When I make an ear using Maven (mvn clean install), everything is going well, the project