Lombok

相同类中方法间调用时日志Aop失效处理

两盒软妹~` 提交于 2019-11-29 09:41:56
本篇分享的内容是在相同类中方法间调用时Aop失效处理方案,该问题我看有很多文章描述了,不过大多是从事务角度分享的,本篇打算从日志aop方面分享(当然都是aop,失效和处理方案都是一样),以下都是基于springboot演示; 快速定义个日志Appender 快速定义个拦截器和日志注解(aop) 模拟相同类中方法间调用时aop失效 Aop失效处理方案(就两种足够了) 快速定义个日志Appender 日志我还是喜欢log4j,大部分朋友也同样吧,这里lombok与log4j结合来完成我们的日志,如下maven包(最新mvn还是建议去官网找): <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>2.0.0-alpha0</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>2.0.0-alpha0<

Intellij idea 不能识别 @Slf4j,@Getter ,@Setter注解,编译通过

南楼画角 提交于 2019-11-29 05:27:56
参考文档 解决及分析 https://my.oschina.net/baishi/blog/515346 IDEA插件安装 https://www.jb51.net/article/129451.htm 分析原因 Intellij idea 设置 Setting - Compiler - Annotation Processors - Enable annotation processing 勾选,目的是启用注解处理,maven clean之后再编译,问题,依旧没有解决。 去 Intellij idea 官方论坛找到,是 Lombok插件没有安装,安装 Lombok 插件,重启Intellij idea 问题解决 。 Lombok插件安装 Windows下:File -> Settings -> Plugins 点击蓝色的【Search in repositories】, 点击【Install】按钮就可以在线安装了。 安装完毕,报错消失了。 来源: oschina 链接: https://my.oschina.net/u/3866531/blog/1862853

Lombok Requires Annotation Processing

孤街醉人 提交于 2019-11-29 02:49:53
I'm using Android Studio 2.2 Preview 7, and the Lombok plugin suddenly started saying: Annotation processing seems to be disabled for the project X , and providing a link to settings. Clicking on the notification does not take me to the right place. What is the fix for this? The Settings opened by clicking the notification are the Per Project settings, and those are not what you need in this case. To fix this, go to File->Other Settings->Default Settings Expand Build, Execution, Deployment Expand Compiler In Annotation Processors check Enable annotation processing You may need to re-open the

崛起于Springboot2.X + 多模块整合 + 一个启动类 + jar、war打包运行(60)

时光怂恿深爱的人放手 提交于 2019-11-29 02:01:22
《SpringBoot2.X心法总纲》 博客概要:Springboot多模块项目搭建 + 打包jar运行 + 打包war运行 + 一个启动类(有的项目是多模块多个启动类),为后续的SpringCloud项目作准备。 父工程:father 子模块:sun1、sun2、web(启动模块) 1、创建父工程 勾选SpringWeb和lombok 如图所示 然后删除src文件夹,如图: 然后修改pom文件,添加一行打包类型 <packaging>pom</packaging> 2、创建子模块 创建3个子模块,分别为sun1、sun2、web,不勾选任何依赖。 3、father的pom.xml修改 创建好三个模块之后,在father项目父工程pom.xml添加依赖 <modules> <module>sun1</module> <module>sun2</module> <module>web</module> </modules> 更换pom.xml插件,准备打包使用 <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source

Maven Scope for Lombok (Compile vs. Provided)

可紊 提交于 2019-11-29 01:27:57
问题 I recently found out that the lombok.jar ends up in our final artifact, which shouldn't be necessary. In my understanding lombok is compile-time only. <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.14.4</version> </dependency> But when I set it to scope provided, I get strange behaviour in unit tests. They crash with ClassNotFoundExceptions then when trying to resolve java.lang.NoClassDefFoundError: com/svv/esp/serviceimpl/dataimport/common

ObjectMapper can't deserialize without default constructor after upgrade to Spring Boot 2

痞子三分冷 提交于 2019-11-28 22:21:33
问题 I have following DTOs: @Value public class PracticeResults { @NotNull Map<Long, Boolean> wordAnswers; } @Value public class ProfileMetaDto { @NotEmpty String name; @Email String email; @Size(min = 5) String password; } @Value is a Lombok annotation which generates a constructor. Which means that this class doesn't have a no-arg constructor. I used Spring Boot 1.4.3.RELEASE and ObjectMapper bean was able to deserialize such object from JSON. After the upgrade to Spring Boot 2.0.0.M7 I receive

Warning equals/hashCode on @Data annotation lombok with inheritance

南笙酒味 提交于 2019-11-28 21:20:52
问题 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

How to ignore the Java Source directory during Maven Compilation?

試著忘記壹切 提交于 2019-11-28 20:26:31
I am trying to use the Lombok Maven Plugin to ensure the correct creation of Javadocs when using Lombok . Lombok Maven introduces a new code generation goal, just prior to compilation. In my configuration, my sourceDirectory (Java with Lombok annotations, src/main/java ) is processed to create Java (without Lombok annotations) in target/generated-sources/delombok . However, every file in sourceDirectory now has a corresponding (identically named) file in target/generated-sources/delombok , resulting in compilation failures due to duplicate classes. How can I tell the Java compiler to ignore

Writing custom Lombok Annotation handlers

爱⌒轻易说出口 提交于 2019-11-28 19:14:05
I want to write custom Lombok Annotation handlers. I know http://notatube.blogspot.de/2010/12/project-lombok-creating-custom.html . But the current lombok jar file does not contain many .class files, but files named .SCL.lombok instead. I found, the .SCL.lombok files are the .class files, the build script of Lombok does rename them while generating the jar file, and the ShadowClassLoader is capable of loading these classes -- and the acronym SCL seems to come from this. It seems the reason for this is just to "Avoid contaminating the namespace of any project using an SCL-based jar.

lombok 不用再写pojo的getset

无人久伴 提交于 2019-11-28 19:10:13
java实体类不写get/set方法 1、下载地址https://projectlombok.org/download Myeclipse、eclipse安装lombok Lombok是一种Java实用工具,可以帮助开发人员消除Java的冗长,具体看lombok的官网:http://projectlombok.org/ 安装步骤:   1.下载lombok.jar包   2.将lombok.jar包复制到myeclipse.ini/eclipse.ini所在文件目录   3.打开myeclipse.ini/eclipse.ini,在最后添加以下代码并保存:     -javaagent:lombok.jar   4.重启myeclipse/eclipse.   5.project==>clean 清理项目 友情链接: https://www.cnblogs.com/justuntil/p/7120534.html 上面那个没什么用 https://blog.csdn.net/qq_32447321/article/details/60570051 来源: oschina 链接: https://my.oschina.net/u/3236388/blog/1927988