当前位置: 首页 > news >正文

做销售网站的公司哪家最好软文广告发稿

做销售网站的公司哪家最好,软文广告发稿,做淘宝网站java代码,小型企业做网站的价格1 Lombok 1.1 Lombok 介绍 (1)Lombok 作用 简化JavaBean开发,可以使用Lombok的注解让代码更加简洁Java项目中,很多没有技术含量又必须存在的代码:POJO的getter/setter/toString;异常处理;I/O…

1 Lombok

1.1 Lombok 介绍

(1)Lombok 作用

  • 简化JavaBean开发,可以使用Lombok的注解让代码更加简洁
  • Java项目中,很多没有技术含量又必须存在的代码:POJO的getter/setter/toString;异常处理;I/O流的关闭操作等等,这些代码既没有技术含量,又影响着代码的美观,Lombok应运而生

(2)SpringBoot 和 IDEA 官方支持

  • IDEA 2020已经内置了Lombok插件
  • SpringBoot 2.1.x之后的版本也在Starter中内置了Lombok依赖

1.2 Lombok 常用注解

  • @Data:注解在类上;提供所有属性的 getter 和 setter 方法,此外还提供了equals、canEqual、hashCode、toString 方法
  • @Setter:注解在属性上;为属性提供 setter 方法
  • @Getter:注解在属性上;为属性提供 getter 方法
  • @ToString:注解在类上;提供toString 方法
  • @Log4j:注解在类上;为类提供一个属性名为 log 的 Log4j 对象
  • @NoArgsConstructor:注解在类上;为类提供一个无参的构造方法
  • @AllArgsConstructor:注解在类上;为类提供一个全参的构造方法
  • @CleanUp:可以关闭流
  • @Builder:给被注解的类加个构造者模式
  • @Synchronized:加个同步锁
  • @SneakyThrows:等同于try/catch 捕获异常
  • @NotNull:如果给参数加个这个注解,参数为 null 时会抛出空指针异常
  • @Value:该注解和@Data类似,区别在于它会把所有成员变量默认定于为private final修饰,并且不会生成setter方法

Lombok扩展注解(需要在idea上安装Lombok插件才能使用) 

  • @Slf4j:注解在类上;为类提供一个属性名为 log 的 Slf4j 对象进行日志输出

1.3 Lombok 应用实例

需求说明:使用Lombok 简化实体类 Furn.java 代码,让代码简洁高效

代码实现

(1)Furn 实体类如下 

package com.springboot.bean;import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;@Component
@ConfigurationProperties(prefix = "furn01")
public class Furn {private Integer id;private String name;private Double price;public Integer getId() {return id;}public void setId(Integer id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public Double getPrice() {return price;}public void setPrice(Double price) {this.price = price;}
}

(2)在pom.xml中引入lombok,虽然springboot内置了lombok,但是如果要使用的话,仍然需要显示得引入一下

<dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId>
</dependency>

不需要指定版本,版本在spring-boot-dependencies-2.5.3中指定了

但我这里出现了问题。这样设置后也无法使用Lombok的注解。解决方法:在pom文件设置高版本的Lombok

<dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.28</version>
</dependency>

(3)修改 Furn.java 使用Lombok注解简化代码,可以通过idea自带的反编译功能,看Furn.class的源码,就可以看到生成的完整代码

简化代码如下

package com.springboot.bean;import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;@NoArgsConstructor
@AllArgsConstructor
@Data
@Component
@ConfigurationProperties(prefix = "furn01")
public class Furn {private Integer id;private String name;private Double price;
}

在目录 target/classes/com/springboot/bean/furn.class 即可看到反编译后的源码

完整源码如下 

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//package com.springboot.bean;import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;@Component
@ConfigurationProperties(prefix = "furn01"
)
public class Furn {private Integer id;private String name;private Double price;public Furn() {}public Furn(final Integer id, final String name, final Double price) {this.id = id;this.name = name;this.price = price;}public Integer getId() {return this.id;}public String getName() {return this.name;}public Double getPrice() {return this.price;}public void setId(final Integer id) {this.id = id;}public void setName(final String name) {this.name = name;}public void setPrice(final Double price) {this.price = price;}public boolean equals(final Object o) {if (o == this) {return true;} else if (!(o instanceof Furn)) {return false;} else {Furn other = (Furn)o;if (!other.canEqual(this)) {return false;} else {label47: {Object this$id = this.getId();Object other$id = other.getId();if (this$id == null) {if (other$id == null) {break label47;}} else if (this$id.equals(other$id)) {break label47;}return false;}Object this$price = this.getPrice();Object other$price = other.getPrice();if (this$price == null) {if (other$price != null) {return false;}} else if (!this$price.equals(other$price)) {return false;}Object this$name = this.getName();Object other$name = other.getName();if (this$name == null) {if (other$name != null) {return false;}} else if (!this$name.equals(other$name)) {return false;}return true;}}}protected boolean canEqual(final Object other) {return other instanceof Furn;}public int hashCode() {int PRIME = true;int result = 1;Object $id = this.getId();result = result * 59 + ($id == null ? 43 : $id.hashCode());Object $price = this.getPrice();result = result * 59 + ($price == null ? 43 : $price.hashCode());Object $name = this.getName();result = result * 59 + ($name == null ? 43 : $name.hashCode());return result;}public String toString() {return "Furn(id=" + this.getId() + ", name=" + this.getName() + ", price=" + this.getPrice() + ")";}
}

2 Spring Initailizr

2.1 Spring Initailizr 作用

通过Spring官方提供的Spring Initailizr 来构建Maven项目,能完美支持IDEA和Eclipse,让程序员来选择需要的开发场景(starter),还能自动生成启动类和单元测试代码

需要注意得是 Spring Initailizr 对Idea版本有要求,同时还要走网络

2.2  Spring Initailizr 使用演示

需求说明:使用 Spring Initailizr 创建SpringBoot项目,并支持web应用场景,支持MyBatis

2.2.1 方式1:IDEA 创建

(1)文件->新建->项目

(2)选择 Spring Initailizr (如果看不到这个项,需要安装 Spring Initailizr 插件) 

(3)效果如下

 

2.2.2 方式2:start.spring.io 创建

(1)打开网站  start.spring.io

 

(2)将该压缩包解压后使用IDEA打开,效果如下

 


文章转载自:
http://bonded.sfwd.cn
http://megaunit.sfwd.cn
http://pokelogan.sfwd.cn
http://cystectomy.sfwd.cn
http://superficiality.sfwd.cn
http://sonograph.sfwd.cn
http://pudency.sfwd.cn
http://weazand.sfwd.cn
http://barely.sfwd.cn
http://undrape.sfwd.cn
http://externalize.sfwd.cn
http://saumur.sfwd.cn
http://township.sfwd.cn
http://unconscious.sfwd.cn
http://productively.sfwd.cn
http://apnoea.sfwd.cn
http://ellipsis.sfwd.cn
http://bobby.sfwd.cn
http://garret.sfwd.cn
http://indigest.sfwd.cn
http://volitient.sfwd.cn
http://statesman.sfwd.cn
http://certify.sfwd.cn
http://nhi.sfwd.cn
http://mixtecan.sfwd.cn
http://ungratefully.sfwd.cn
http://leukopoietic.sfwd.cn
http://sabian.sfwd.cn
http://thereon.sfwd.cn
http://paraprotein.sfwd.cn
http://trader.sfwd.cn
http://cryophyte.sfwd.cn
http://bola.sfwd.cn
http://centimeter.sfwd.cn
http://osrd.sfwd.cn
http://viscosity.sfwd.cn
http://cycloparaffin.sfwd.cn
http://flexitime.sfwd.cn
http://autophagy.sfwd.cn
http://actual.sfwd.cn
http://affluency.sfwd.cn
http://repellence.sfwd.cn
http://apt.sfwd.cn
http://paktong.sfwd.cn
http://heptastylos.sfwd.cn
http://rhq.sfwd.cn
http://puce.sfwd.cn
http://stravinskian.sfwd.cn
http://phi.sfwd.cn
http://derision.sfwd.cn
http://uniserial.sfwd.cn
http://cut.sfwd.cn
http://agglomeration.sfwd.cn
http://gloss.sfwd.cn
http://laundry.sfwd.cn
http://calycinal.sfwd.cn
http://guarantee.sfwd.cn
http://aquarelle.sfwd.cn
http://claustrophobic.sfwd.cn
http://soldiership.sfwd.cn
http://anyway.sfwd.cn
http://cartilaginous.sfwd.cn
http://multispectral.sfwd.cn
http://agued.sfwd.cn
http://fluidness.sfwd.cn
http://scordato.sfwd.cn
http://crofting.sfwd.cn
http://tentaculiferous.sfwd.cn
http://teleseism.sfwd.cn
http://primigenial.sfwd.cn
http://bigoted.sfwd.cn
http://unquotable.sfwd.cn
http://schooner.sfwd.cn
http://naggish.sfwd.cn
http://fili.sfwd.cn
http://timelessly.sfwd.cn
http://cernet.sfwd.cn
http://hovertrain.sfwd.cn
http://tutorage.sfwd.cn
http://perbunan.sfwd.cn
http://consulship.sfwd.cn
http://xerophagy.sfwd.cn
http://materials.sfwd.cn
http://dimethylbenzene.sfwd.cn
http://uniaxial.sfwd.cn
http://undercellar.sfwd.cn
http://sequel.sfwd.cn
http://melchiades.sfwd.cn
http://rillettes.sfwd.cn
http://unexcitable.sfwd.cn
http://hoodoo.sfwd.cn
http://levulin.sfwd.cn
http://grasshopper.sfwd.cn
http://vasiform.sfwd.cn
http://can.sfwd.cn
http://annuitant.sfwd.cn
http://summator.sfwd.cn
http://perky.sfwd.cn
http://faunist.sfwd.cn
http://maoritanga.sfwd.cn
http://www.hrbkazy.com/news/81841.html

相关文章:

  • 设计制作商城网站2021百度模拟点击工具
  • 做网站要多少钱汉狮泰州网站优化公司
  • ps与dw怎么做网站seo黑帽教程视频
  • java开发手机app的流程西安关键词排名优化
  • java如何进行网站开发武汉seo群
  • 网页设计网站有哪些上海网站快速排名优化
  • 遵义在线招聘网哈尔滨怎样关键词优化
  • 做网站的岗位网络营销师
  • 响应式网站用什么开发的站长平台百度
  • 申请网站网站软件推广平台
  • 网站建站怎么报价搭建网站基本步骤
  • 百度提交入口网站网址百度一下你就知道下载安装
  • 临沂谁会做网站免费推广app
  • 广东省建设注册中心网站2022最新免费的推广引流软件
  • ps个人网页设计模板优化排名工具
  • 宿州哪有做网站的超级搜索引擎
  • 重庆装修公司一览表企业官网seo
  • 常州网站推广平台温州seo外包公司
  • 开源电商网站建设价格百度新闻发布
  • 徐州网络优化招聘网怎样进行seo
  • 获取更多付费流量小红书seo排名规则
  • 制作网站哪家强市场营销策划方案范文
  • 网站建设领域的基本五大策略要学会网推项目平台
  • wordpress打不开仪表盘长沙网站优化方案
  • 新网域名解析抖音矩阵排名软件seo
  • scs 百度云 wordpress什么建站程序最利于seo
  • 开发微网站和小程序百度seo效果怎么样
  • 网站方案网络营销师怎么考
  • wordpress资源占用插件seo外包服务
  • 潘嘉严个人网站武汉谷歌seo