Click on "end of life", pay attention to the official account.
Daily technical dry goods, delivered at the first time!
1,SpringBoot Dedevtools
It is a tool for spring boot to support hot deployment. The following is the referenced method
Or check the following configuration directly when creating the project:
Either add the following dependencies to the springBoot project:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
-
After idea modifies the code, press ctrl + f9 to recompile it, and the hot deployment function is completed
-
eclipse is automatically compiled by pressing ctrl + s to save
If you want to automatically recompile as soon as you modify the code, you don't need to press ctrl+f9. Only the following operations are required:
1. Tick the following boxes in the setting of idea
2. Enter POM XML, give a cursor after the anti tag of build, and then press Alt+Shift+ctrl+/
3. Then check the following items and restart idea
2,Lombok
Lombok is a tool to simplify JavaBean development, allowing developers to save the writing of constructors, getters and setters.
Check the following configuration during project initialization to use Lombok
Or import the following dependencies in the project:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
When using idea, you also need to download the following plug-ins:
The following examples are used
@AllArgsConstructor//Full parameter constructor
@NoArgsConstructor//Parameterless constructor
@Data//getter + setter
public class User {
private Long id;
private String name;
private Integer age;
private String email;
}
3,Spring Configuration Processor
The tool injects an opening prompt into the attributes of the entity class. I feel that the tool is not very meaningful!
Because SpringBoot has attribute injection, such as the following entity classes:
@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 + "]";
}
}
Want to be in application Properties and application mypet is injected with attributes in YML without any prompt. To solve this problem, check the following scenario when creating SpringBoot:
Or add the following dependencies directly to the project:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
And exclude the packaging of the tool in the build tag: (reduce the size of the jar package)
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
PS: in case you can't find this article, you can collect some likes for easy browsing and searching.