Spring Boot 配置 IDEA和DevTools 热部署的方法
程序员文章站
2023-08-13 19:33:27
maven 配置
maven 配置
<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>cn.globalrave</groupid> <artifactid>bar-web</artifactid> <version>0.0.1-snapshot</version> <packaging>jar</packaging> <name>bar-web</name> <description>bar project for spring boot</description> <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.5.6.release</version> <relativepath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <project.reporting.outputencoding>utf-8</project.reporting.outputencoding> <java.version>1.8</java.version> </properties> <dependencies> <!--微信--> <dependency> <groupid>com.github.sd4324530</groupid> <artifactid>fastweixin</artifactid> <version>1.3.15</version> </dependency> <!--mysql 驱动--> <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> </dependency> <!--mybatis orm--> <dependency> <groupid>org.mybatis.spring.boot</groupid> <artifactid>mybatis-spring-boot-starter</artifactid> <version>1.3.0</version> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-aop</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-cache</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-freemarker</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-web</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-websocket</artifactid> </dependency> <!--热部署--> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-devtools</artifactid> <scope>runtime</scope> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-test</artifactid> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-maven-plugin</artifactid> <!--热部署配置--> <configuration> <fork>true</fork> </configuration> </plugin> </plugins> </build> </project>
idea 配置
•ctrl + shift + a 查找 勾选 make project automatically 选项
•ctrl+shift+alt+/ 查找registry 勾选 compiler.automake.allow.when.app.running 选项
devtools 配置
默认改变 /meta-inf/maven, /meta-inf/resources, /resources, /static, /public or /templates 等目录文件,会重新重启项目,当然我们编辑静态文件不想重启项目可以配置
spring.devtools.restart.exclude=static/**,public/** # devtools (devtoolsproperties) spring.devtools.livereload.enabled=true # enable a livereload.com compatible server. spring.devtools.livereload.port=35729 # server port. spring.devtools.restart.additional-exclude= # additional patterns that should be excluded from triggering a full restart. spring.devtools.restart.additional-paths= # additional paths to watch for changes. spring.devtools.restart.enabled=true # enable automatic restart. 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. spring.devtools.restart.quiet-period=400 # amount of quiet time (in milliseconds) required without any classpath changes before a restart is triggered. spring.devtools.restart.trigger-file= # name of a specific file that when changed will trigger the restart check. if not specified any classpath file change will trigger the restart. # remote devtools (remotedevtoolsproperties) spring.devtools.remote.context-path=/.~~spring-boot!~ # context path used to handle the remote connection. spring.devtools.remote.debug.enabled=true # enable remote debug support. spring.devtools.remote.debug.local-port=8000 # local remote debug server port. spring.devtools.remote.proxy.host= # the host of the proxy to use to connect to the remote application. spring.devtools.remote.proxy.port= # the port of the proxy to use to connect to the remote application. spring.devtools.remote.restart.enabled=true # enable remote restart. spring.devtools.remote.secret= # a shared secret required to establish a connection (required to enable remote support). spring.devtools.remote.secret-header-name=x-auth-token # http header used to transfer the shared secret.
总结
以上所述是小编给大家介绍的spring boot 配置 idea和devtools 热部署的方法,希望对大家有所帮助,如果大家 有任何疑问欢迎给我留言,小编会及时回复大家的!
上一篇: 微信小程序 实现动态显示和隐藏某个控件
推荐阅读
-
Spring Boot集成spring-boot-devtools开发时实现热部署的方式
-
Springboot在IDEA热部署的配置方法
-
spring-boot读取props和yml配置文件的方法
-
spring boot devtools在Idea中实现热部署方法
-
Spring Boot 配置 IDEA和DevTools 热部署的方法
-
Springboot在IDEA热部署的配置方法
-
spring boot devtools在Idea中实现热部署方法
-
Spring Boot 配置 IDEA和DevTools 热部署的方法
-
spring boot配置MySQL数据库连接、Hikari连接池和Mybatis的简单配置方法
-
Spring Boot 打包与热部署的操作方法