只需要添加 pom
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
排除静态资源
建议我们将静态资源放在以下目录
- /META-INF/maven
- /META-INF/resources
- /resources
- /static
- /public
- /templates
根据个人喜好,可以放置,
在application.properties中配置
spring.devtools.restart.exclude=static/**,public/**
静态资源更改好,应用不会重启
spring默认,已经设置了
spring.devtools.restart.exclude=META-INF/maven/**,META-INF/resources/**,resources/**,static/**,public/**,templates/**,**/*Test.class,**/*Tests.class,git.properties # Patterns that should be excluded from triggering a full restart.
spring.devtools.restart.poll-interval=1000 # Amount of time (in milliseconds) to wait between polling for classpath changes.
idea如果不能自动重启请看
Intellij IDEA 使用Spring-boot-devTools无效解决办法
网友评论