zoukankan      html  css  js  c++  java
  • Lombok使用方法

    资料 : 
    
      1.学习Spring Boot:(十五)使用Lombok来优雅的编码
    
      https://www.cnblogs.com/qnight/p/8997493.html
    
      2.Lombok介绍、使用方法和总结
    
      http://www.yuanrengu.com/index.php/20180324.html
    

      

    Lombok能以简单的注解形式来简化java代码,提高开发人员的开发效率。
    
    例如:
    
      开发中经常需要写的javabean,都需要花时间去添加相应的getter/setter,也许还要去写构造器、equals等方法,而且需要维护,当属性多时会出现大量的getter/setter方法
    
    Lombok能通过注解的方式,在编译时自动为属性生成构造器、getter/setter、equals、hashcode、toString方法。出现的神奇就是在源码中没有getter和setter方法,但是在编译生成的字节码文件中有getter和setter方法。这样就省去了手动重建这些代码的麻烦,使代码看起来更简洁些。
    
    
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.16.20</version>
        <scope>provided</scope>
    </dependency>
    
    
    @Data注解在类上,会为类的所有属性自动生成setter/getter、equals、canEqual、hashCode、toString方法,如为final属性,则不会为该属性生成setter方法。
    

      

  • 相关阅读:
    《将博客搬至CSDN》
    Ubuntu 安装 maven
    Ubuntu jdk1.8安装
    spring整合jms
    jms入门
    MySQL 3306端口开启
    黑窗口下mysql导出导入数据库
    PHP 爬虫体验(三)
    解决nvm安装的node使用sudo npm报错的问题
    PHP 爬虫体验(二)
  • 原文地址:https://www.cnblogs.com/jiuya/p/11503726.html
Copyright © 2011-2022 走看看