JavaEE——Common dependency packages and their functions in SpringBoot projects

When building, often import dependent packages as follows:

insert image description here
You can import what you want according to your needs (generally, if you want to re-add a dependency package in the middle, you can insert it in the dependencies in pom.xml, and pay attention to refresh!!!! Otherwise it will not work)

1.Spring Web

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
 </dependency>

2.spring-boot-devtools:

Hot deployment is to reload the modified classes and configuration files, so you will see the process of project startup during the reloading process, which is essentially just reloading the modified classes and configuration files, so the speed is extremely fast.

<!--devtools热部署-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>

3.Lombok

Using Lombok in a project can reduce a lot of repetitive code writing. For example, the writing of methods such as getter/setter/toString.
@Getter/@Setter: On the action class, generate getter/setter methods for all member variables.
@ToString : Acts on the class, overrides the default toString() method, can limit the display of certain fields through the of attribute, and exclude certain fields through the exclude attribute.
@AllArgsConstructor: Generate a full parameter constructor.
@NoArgsConstructor: Generate a parameterless constructor.
@Data: This annotation is used on a class, which provides getter, setter, equals, hashCode,
toString methods.

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

4.Thymeleaf

is a Java library. It is an XML/XHTML/HTML5 template engine that can be used to transform template files to display data and text generated by your application.

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

5.MySQL Driver

Use the MySQL database driver package

<dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

6.Mybatis Framework

Dependency Description: Support custom SLQ, stored procedure and advanced mapping. MyBatis uses XML descriptors or annotations to couple objects with stored procedures or SQL statements.

<dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.2.2</version>
        </dependency>

7. There are additional dependencies

<!--mybatis-plus 依赖包 -->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.4.2</version>
        </dependency>
<!—后端代码自动生成 依赖包-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-generator</artifactId>
            <version>3.5.1</version>
        </dependency>
<!—Springsecurity这里加上可以起到保护作用,推出登录地址为/logout 依赖包-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>

Guess you like

Origin blog.csdn.net/qq_46304554/article/details/127438629