Spring Boot 配置 IDEA和DevTools 熱部署的方法
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 驅(qū)動(dòng)-->
<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 選項(xiàng)
•ctrl+shift+alt+/ 查找Registry 勾選 compiler.automake.allow.when.app.running 選項(xiàng)
DevTools 配置
默認(rèn)改變 /META-INF/maven, /META-INF/resources, /resources, /static, /public or /templates 等目錄文件,會(huì)重新重啟項(xiàng)目,當(dāng)然我們編輯靜態(tài)文件不想重啟項(xiàng)目可以配置
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.
總結(jié)
以上所述是小編給大家介紹的Spring Boot 配置 IDEA和DevTools 熱部署的方法,希望對(duì)大家有所幫助,如果大家 有任何疑問(wèn)歡迎給我留言,小編會(huì)及時(shí)回復(fù)大家的!
相關(guān)文章
使用Spring AOP監(jiān)控指定方法執(zhí)行時(shí)間的代碼詳解
這篇文章主要介紹了使用Spring AOP監(jiān)控指定方法執(zhí)行時(shí)間,文中通過(guò)代碼示例給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作有一定的幫助,需要的朋友可以參考下2024-08-08
基于Spring上下文工具類?ApplicationContextUtil
這篇文章主要介紹了基于Spring上下文工具類?ApplicationContextUtil,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-11-11
揭秘SpringBoot!一分鐘教你實(shí)現(xiàn)配置的動(dòng)態(tài)神刷新
在今天的指南中,我們將深入探索SpringBoot?動(dòng)態(tài)刷新的強(qiáng)大功能,讓你的應(yīng)用保持最新鮮的狀態(tài),想象一下,無(wú)需重啟,你的應(yīng)用就能實(shí)時(shí)更新配置,是不是很酷?跟我一起,讓我們揭開(kāi)這項(xiàng)技術(shù)如何讓開(kāi)發(fā)變得更加靈活和高效的秘密吧!2024-03-03
AbstractProcessor擴(kuò)展MapStruct自動(dòng)生成實(shí)體映射工具類
這篇文章主要為大家介紹了AbstractProcessor擴(kuò)展MapStruct自動(dòng)生成實(shí)體映射工具類實(shí)現(xiàn)詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-01-01
Java請(qǐng)求調(diào)用參數(shù)格式為form-data類型的接口代碼示例
這篇文章主要給大家介紹了關(guān)于Java請(qǐng)求調(diào)用參數(shù)格式為form-data類型的接口的相關(guān)資料,文中給出了詳細(xì)的代碼示例,對(duì)大家的學(xué)習(xí)或者工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2023-08-08
eclipse自動(dòng)創(chuàng)建SpringBoot項(xiàng)目報(bào)錯(cuò)的解決
這篇文章主要介紹了eclipse自動(dòng)創(chuàng)建SpringBoot項(xiàng)目報(bào)錯(cuò)的解決方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-01-01
IDEA的Web項(xiàng)目右鍵無(wú)法創(chuàng)建Servlet問(wèn)題解決辦法
這篇文章主要介紹了IDEA的Web項(xiàng)目右鍵無(wú)法創(chuàng)建Servlet問(wèn)題解決辦法的相關(guān)資料,在IDEA中新建Servlet時(shí)發(fā)現(xiàn)缺失選項(xiàng),可以通過(guò)在pom.xml文件中添加servlet依賴解決,文中通過(guò)圖文介紹的非常詳細(xì),需要的朋友可以參考下2024-10-10
Java實(shí)現(xiàn)的讀取資源文件工具類ResourcesUtil實(shí)例【可動(dòng)態(tài)更改值的內(nèi)容】
這篇文章主要介紹了Java實(shí)現(xiàn)的讀取資源文件工具類ResourcesUtil,結(jié)合實(shí)例形式分析了java針對(duì)資源文件的讀取與修改相關(guān)操作技巧,需要的朋友可以參考下2017-10-10
mybatis-plus 查詢時(shí)排除字段方法的兩種方法
我們?cè)陂_(kāi)發(fā)應(yīng)用時(shí),在某些應(yīng)用場(chǎng)景下查詢有時(shí)需要排除某些字段,本文主要介紹了兩種方法,具有一定的參考價(jià)值,感興趣的可以了解一下2023-09-09

