开发者学堂课程【SpringBoot 实战教程:配置工程为开发模式】学习笔记,与课程紧密联系,让用户快速学习知识。
课程地址:https://developer.aliyun.com/learning/course/651/detail/10786
配置工程为开发模式
1、可以发现每次对代码进行修改后,都需要手动重新启动,在开发过程中很麻烦,所以可以把工程设置为开发模式,这样就不需要每次修改后重新手动启动。
2、设置为开发模式需要加入以下两个依赖,一个是叫 springloaded,一个是 spring-boot-devtools 开发工具。
<!--加入以下依赖,代码做了修改,不用重新运行 -->
<dependency>
<groupId>org . spring framework</ groupId>
<arti factId>springloaded</ artifactId>
</dependency
>
<dependency>
<groupId>org. spring framework . boot</ groupId>
<artifactId> spring-boot-devtools</ artifactId>
</ dependency>
3、把两个依赖加入到 pom 中,把两个包依赖后会发现,工程上会发生变化,后面会出现 devtools,说明这个工程已经设置为开发模式。
4、从入口启动,在 testcontroller 做修改,比如 log.error (”error 日志*****“),注意控制台,做完修改后就自动重新启动了,这样就不需要手动启动了,所以在开发过程中就简便很多。
5、访问一下,控制台上是带*的,说明是修改之后的,这就是如何把一个工程设置为开发模式,只需要增加两个依赖。