How many of the three Spring Boot development tools have you used?

1, Springboot dedvetools

It is a tool that enables SpringBoot 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 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 the development of JavaBean s, so that developers can 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

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@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

This tool injects an opening prompt into the attributes of the entity class. I feel that this tool is not of great significance!

Because SpringBoot has attribute injection, such as the following entity classes:

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 + "]";
     }

}

Want to be in application Properties and application mypet is injected with attributes in YML without any prompt. To solve this problem, we 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 from the label of build: (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>

Copyright notice: This article is the original article of the blogger and follows the CC 4.0 BY-SA copyright agreement. For reprint, please attach the source link of the original text and this notice\
Link to this article: https://blog.csdn.net/MoastAl...

Recent hot article recommendations:

1.1000 + Java interview questions and answers (2022 latest version)

2.Hot! The Java collaboration is coming...

3.Spring Boot 2.x tutorial, too complete!

4.20w programmer red envelope cover, get it quickly...

5.Java development manual (Songshan version) is the latest release. Download it quickly!

Feel good, don't forget to like + forward!

Keywords: Java

Added by jimmygee on Tue, 01 Mar 2022 09:46:01 +0200