SpringBoot三大开发工具,你都用过么?
一、SpringBoot Dedevtools
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-devtoolsartifactId>
<optional>trueoptional>
dependency>
1.在idea的setting中把下面的勾都打上
2.进入pom.xml,在build的反标签后给个光标,然后按Alt+Shift+ctrl+/
3.然后勾选下面的东西,接着重启idea即可
二、Lombok
<dependency>
<groupId>org.projectlombokgroupId>
<artifactId>lombokartifactId>
<optional>trueoptional>
dependency>
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@AllArgsConstructor//全参构造器
@NoArgsConstructor//无参构造器
@Data//getter + setter
public class User {
private Long id;
private String name;
private Integer age;
private String email;
}
三、Spring Configuration Processor
package org.lzl.HelloWorld.entity;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @author Lenovo
*
*/
@Component
@ConfigurationProperties(prefix = "mypet")
public class Pet {
private String nickName;
private String strain;
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getStrain() {
return strain;
}
public void setStrain(String strain) {
this.strain = strain;
}
@Override
public String toString() {
return "Pet [nickName=" + nickName + ", strain=" + strain + "]";
}
}
application.properties
和application.yml
中给mypet注入属性,却没有任何的提示,为了解决这一问题,我们在创建SpringBoot的时候勾选下面的场景:<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-configuration-processorartifactId>
<optional>trueoptional>
dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-maven-pluginartifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-configuration-processorartifactId>
exclude>
excludes>
configuration>
plugin>
plugins>
build>
最近给大家找了 JVM优化
资源,怎么领取?
扫二维码,加我微信,回复:JVM优化
注意,不要乱回复 没错,不是机器人 记得一定要等待,等待才有好东西
评论