• 需要在项目中添加热部署依赖
<!--依赖中添加-->   
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <scope>runtime</scope>
    <optional>true</optional>
</dependency>

<!--build模块中添加-->
<build>
	<plugins>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
			<version>1.5.9.RELEASE</version>
			<configuration>
				<fork>true</fork> #重点是这里
				<addResources>true</addResources>
			</configuration>
		</plugin>
	</plugins>
</build>
  • 需要修改项目配置文件,允许项目进行热部署,示例中是yml文件
spring:
  devtools:
    restart:
      enabled: true
  • 修改idea配置
    • file->settings->Advanced Settings               
    • file->settings->Builds,Execution,Deployment->Compiler              
  •   重启idea后即可实现热部署 

以上是idea2023实现热部署的方式,如果哪里有些的不对的地方,欢迎指正,一起进步。我是一个擅长写bug的小白程序员!

Logo

一站式 AI 云服务平台

更多推荐