使用 Spring 的元注释扩展 lombok 注释 [英] Extending a lombok annotation using Spring's meta-annotations

查看:42
本文介绍了使用 Spring 的元注释扩展 lombok 注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近发现了 lombok,我很享受它的使用带来的舒适感.我只缺少一件特别的事情.

I recently discovered lombok and I enjoy the comfort it's usage brings. There is only one particular thing I am missing.

所以只是出于好奇:我如何扩展 @AllArgsConstructor 注释,以便为应用它的类提供额外的默认构造函数?

So just out of curiosity: How could I extend the @AllArgsConstructor annotation in a way that it provides an additional default constructor to the class on which it is applied?

我正在考虑使用 Spring 4.0 的功能来构建 组合注释,但我必须承认我以前从未编写过自定义注释.所以我真的不知道如何开始......

I was thinking of using Spring 4.0's capability to build composed annotations, but I must admit I never programmed a custom annotation before. So I don't really know how to start ...

有什么建议吗?

推荐答案

我不知道如何扩展注解,但是如果要添加默认构造函数,可以添加 Lombok @NoArgsConstructor 注解.

I don't know how to extend the annotation, but if you want to add a default constructor, you can add the Lombok @NoArgsConstructor annotation.

这篇关于使用 Spring 的元注释扩展 lombok 注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆