目录

依赖

启动器

web依赖

单元测试依赖 

解决实体类使用注解@ConfigurationProperties(prefix = "person")时爆红依赖

jsr303校验依赖

thymeleaf模板引擎使用依赖 

lombok依赖

JDBC依赖

MYSQL驱动依赖

build

项目打包插件




依赖

启动器

<!--启动器-->
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter</artifactId>
</dependency>

web依赖

<!--web依赖: tomcat,dispatcherServlet.xml-->
<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-web</artifactId>
</dependency>

单元测试依赖 

<dependency>
   <!--单元测试-->
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-test</artifactId>
   <scope>test</scope>
</dependency>

解决实体类使用注解@ConfigurationProperties(prefix = "person")时爆红依赖

<!-- 导入配置文件处理器,配置文件进行绑定就会有提示,需要重启 -->
<dependency>
   <!--这个依赖是解决person实体类使用注解@ConfigurationProperties(prefix = "person")时爆红的问题,虽然这个爆红不影响程序运行-->
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-configuration-processor</artifactId>
         <optional>true</optional>
</dependency>

jsr303校验依赖

<dependency>
   <!--当需要使用jsr303校验时需要导入该依赖-->
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-validation</artifactId>
</dependency>

thymeleaf模板引擎使用依赖 

<!--以下两个依赖是thymeleaf模板引擎使用所需要的引擎-->
<dependency>
   <groupId>org.thymeleaf</groupId>
   <artifactId>thymeleaf-spring5</artifactId>
</dependency>
<dependency>
   <groupId>org.thymeleaf.extras</groupId>
   <artifactId>thymeleaf-extras-java8time</artifactId>
</dependency>

lombok依赖

lombok依赖是方便实体类使用get set等  

@Data是getset方法

@AllArgsConstructor有参构造函数

@NoArgsConstructor无参构造函数

<!--lombok依赖是方便实体类使用get set等  @Data是getset方法 @AllArgsConstructor有参构造函数 @NoArgsConstructor无参构造函数-->
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
		</dependency>


JDBC依赖

<!--JDBC依赖-->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-jdbc</artifactId>
		</dependency>


MYSQL驱动依赖

<!--MYSQL驱动依赖-->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<scope>runtime</scope>
		</dependency>
 

build

项目打包插件

<plugins>
<!--打jar包插件-->
	<plugin>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-maven-plugin</artifactId>
	</plugin>
</plugins>

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐