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ū)動--> <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 等目錄文件,會重新重啟項(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 熱部署的方法,希望對大家有所幫助,如果大家 有任何疑問歡迎給我留言,小編會及時回復(fù)大家的!
相關(guān)文章
JVM性能調(diào)優(yōu)之運(yùn)行時參數(shù)小結(jié)
jvm是java的運(yùn)行環(huán)境,在jvm中有很多的參數(shù)可以進(jìn)行設(shè)置,本文主要介紹了JVM性能調(diào)優(yōu)之運(yùn)行時參數(shù)小結(jié),具有一定的參考價值,感興趣的可以了解一下2024-04-04java基于移位操作實(shí)現(xiàn)二進(jìn)制處理的方法示例
這篇文章主要介紹了java基于移位操作實(shí)現(xiàn)二進(jìn)制處理的方法,結(jié)合實(shí)例形式分析了java針對二進(jìn)制的移位操作處理技巧,需要的朋友可以參考下2017-02-02Java實(shí)現(xiàn)Token工具類進(jìn)行登錄和攔截
在應(yīng)用的登錄時需要生成token進(jìn)行驗(yàn)證,并放入信息,之后的話可以直接使用瀏覽器的session進(jìn)行登錄,本文就來利用java編寫一個token工具類,可以很方便的生成和解析token,感興趣的可以了解下2023-12-12java IO數(shù)據(jù)操作流、對象序列化、壓縮流代碼解析
這篇文章主要介紹了java IO數(shù)據(jù)操作流、對象序列化、壓縮流代碼解析,具有一定借鑒價值,需要的朋友可以參考下2018-01-01Java多線程局域網(wǎng)聊天室的實(shí)現(xiàn)
在學(xué)習(xí)了一個學(xué)期的java以后,搞了一個多線程的聊天室,熟悉了一下服務(wù)器和客戶機(jī)的操作。感興趣的小伙伴們可以參考一下2021-06-06java 結(jié)合jQuery實(shí)現(xiàn)跨域名獲取數(shù)據(jù)的方法
下面小編就為大家?guī)硪黄猨ava 結(jié)合jQuery實(shí)現(xiàn)跨域名獲取數(shù)據(jù)的方法。小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-05-05java子類繼承父類實(shí)例-披薩的選擇實(shí)現(xiàn)代碼
這篇文章主要介紹了java子類繼承父類實(shí)例-披薩的選擇實(shí)現(xiàn)代碼,具有一定借鑒價值,需要的朋友可以參考下。2017-12-12