Lombok

IllegalArgumentException: Can´t serialize class (even it implements Serializable)

只愿长相守 提交于 2019-12-12 02:39:23
问题 I successfully set up a MongoDB Database and my Java program is connecting to it fine. However, when I try to save an instance of this class, I get an error: @Data public class NormalUser extends User implements Serializable { private static final long serialVersionUID = 1324235L; public NormalUser(final String name, final String surname, final String address, final String dni, final Gender gender, final String bankAccount) { super(name, surname, address, dni, gender, bankAccount, Role.NORMAL

Implement params convert after lombok mapping

試著忘記壹切 提交于 2019-12-11 19:07:43
问题 I want to use Lombook framework and to extend the Java Class that I map. Currently I use this: // @Mapper(config = BaseMapperConfig.class) public interface MerchantsMapper { MerchantNewDTO toNewDTO(Merchants merchant); } Custom implementation: public MerchantNewDTO toNewDTO(Merchants merchant) { MerchantNewDTO merchantNewDTO = new MerchantNewDTO(); merchantNewDTO.setId(Integer.valueOf(merchant.getId())); ...... MerchantConfigurationUtils merchant_config = new MerchantConfigurationUtils(); Map

Revisiting the conflict of lombok with java runtime compilation

不问归期 提交于 2019-12-11 17:36:24
问题 I am working in IntelliJ Idea, with JDK and JRE 8. The project makes use of lombok, and I would like to have code generation and runtime compiling. My aim is to produce a code that does the same task as some complicated runtime generated lambda function, to speed up the evaluation. The project makes heavy use of lombok. And I have the same issue as the one discussed here, so I know that one way around this problem is to add particular dependencies. My question is: did there appear any other,

Mapstruct is not updating its getters and setters in the generated source files

纵饮孤独 提交于 2019-12-11 16:11:17
问题 I have an entity with a property I used to write like this private Long ICU; I'm using mapstruct: Here is my mapper for said entity: @Mapper(componentModel = "spring") public interface ProtectionQueryMapper extends EntityMapper<ProtectionQueryDto, Protection> { ProtectionQueryDto toDto(Protection protection); Protection toEntity(ProtectionQueryDto protectionQueryDto); List<Protection> toEntity(List<ProtectionQueryDto> protectionQueryDtos); List<ProtectionQueryDto> toDto(List<Protection>

Can not find @Getter and @Setter

孤街浪徒 提交于 2019-12-11 15:54:04
问题 I've tried to add the users and authentication with OAuth. I followed by tutorial: Video Here is his source code: https://github.com/arocketman/Spring-oauth2-jpa-example I've done exactly like him but my Intellij showed me some issuses. I had to change my pom.xml from <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-oauth2</artifactId> </dependency> to <dependency> <groupId>org.springframework.security.oauth.boot</groupId> <artifactId>spring-security

Project Lombok @Slf4j external configuration

别来无恙 提交于 2019-12-11 15:05:23
问题 so I'am writing simple Spring Boot(version 1.56) Application. And started using Project lombok, specifically@Slf4j feature for logging. Logging works fine, but how can I configure this logger? To be precise I want to be able to change logging level using external file. 回答1: It has nothing to do with lombok , it is about slf4j configuration. It should be done by updating your application.properties file. You can check here and here 来源: https://stackoverflow.com/questions/46222068/project

Can't read yaml's complex object using @ConfigurationProperties. Integer cannot be cast to String

℡╲_俬逩灬. 提交于 2019-12-11 14:40:16
问题 I'm trying to read this yml file dist-price: 1234: foo: 4567 bar: false and put into this class. (I'm using Lombok and Spring Boot v1.5.4.RELEASE) @Repository @ConfigurationProperties @Data @NoArgsConstructor public class WebConfigProperty { @NonNull private TreeMap<Integer, Bound> distPrice; } @Data @NoArgsConstructor public class Bound { @NonNull private Integer foo; @NonNull private Boolean bar; } But I got this error. Caused by: java.lang.ClassCastException: java.lang.Integer cannot be

Lombok generated code can not be ignored on coverage

一个人想着一个人 提交于 2019-12-11 12:04:39
问题 Here I asked the question: Lombok, use only getter setter not equals or tostring I did not want to comment there, because it was very old. What I want is, I want the code which is generated by lombok to be ignored during coverage of inteljidea and also sonar. As suggestion in my previous question that I linked , I added this config.stopBubbling = true lombok.addLombokGeneratedAnnotation = true I added this to root ,then rebuilded recoveraged. But for that class @Data @EqualsAndHashCode

IntelliJ IDEA 的 main方法,for循环,syso的快捷键

谁都会走 提交于 2019-12-11 11:30:44
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 今天偶然发现了IntelliJ中 创建main函数的快捷键,依次还有for循环,System.out.println(); 在编写代码的时候直接输入psv就会看到一个psvm的提示,此时点击tab键一个main方法就写好了。 main方法 : psvm 也就是public static void main的首字母。 for循环 依次还有在方法体内键入for会有一个fori的提示,选中然后tab键,就会自动创建一个for循环。 System.out.println() 如何像写一个System.out.println();就是sout 知道了这个规律,应该还有很多类似的用法。 更多的提示可以CTRL + j 可以查看,mac系统下是command+j 。 推荐插件: (1)HighlightBracketPair:自动化高亮显示光标所在代码块对应的括号,可以定制颜色和形状 (2)Rainbow Brackets:彩色显示所有括号,对单行嵌套括号有用 (3).ignore:生成各种ignore文件,一键创建git ignore文件的模板,免得自己去写 (4)Key promoter X :快捷键提示插件,每进行一个鼠标操作,会提示你对应的快捷键是啥 (5)lombok:支持lombok的各种注解

Cannot find symbol error: Lombok 1.18.6 does not work with Gradle 5.2.1, JDK 10

梦想与她 提交于 2019-12-11 10:48:33
问题 Builds with Gradle 5.2.1 and Lombok 1.18.6 dependency are failing with JDK 10. It seems Lombok annotation are not being processed appropriately. I keep getting "cannot find symbol" error across various Java files in my source. Any thoughts on why this might be happening? I found that a defect has already been created: https://github.com/rzwitserloot/lombok/issues/1572 I am using: Java JDK 10 Gradle 5.2.1 Lombok 1.18.6 Thanks. 回答1: I found the following work around for this issue using a