在開發的過程當中,咱們啓動項目後,可能隨時修改、增長方法,爲了不重複啓動項目,咱們能夠啓用熱部署。spring
<!-- 熱啓動,須要編譯以後,eclipse自動編譯,idea須要ct f9 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency>
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>springloaded</artifactId> <version>1.2.2.RELEASE</version> </dependency> </dependencies> </plugin>
@RequestMapping(value = "/now",method = RequestMethod.GET) public String nowTime(){ return "請求時間是:" + LocalDateTime.now(); }
#打包發佈springboot
springboot的maven打包方式不是簡單的mvn package ,若是你不配置插件的話,須要使用 mvn repackage
命令進行打包,若是須要使用 mvn package命令,那須要配置以下插件app
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>1.4.1.RELEASE</version> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> ``` 而後執行mvn package或者在IDE中使用插件直接打包就能夠。