码迷,mamicode.com
首页 > 编程语言 > 详细

SpringBoot项目设置热部署

时间:2017-06-09 13:25:36      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:art   截图   chapter   nbsp   style   自动   cti   client   com   

记录一个SpringBoot 设置热部署(修改项目之后,项目自动重启)实例

 

POM.XML 文件

<!-- 配置springBoot项目的热部署启动 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>

 

 

 

SpringBoot启动类的代码:

package com.xiaowu;

import java.io.IOException;

import org.apache.commons.httpclient.HttpException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;




/**
 * 这是一个配置了热部署启动的springBoot项目
 * 
 * 
 * @author WQ
 *
 */
@RestController
@SpringBootApplication
public class Chapter1Application {
    @RequestMapping("/index")
    public String index() throws HttpException, IOException {
         return "Hello Spring Boot,我是WQ!!!!!";
    }

    public static void main(String[] args) {
        SpringApplication.run(Chapter1Application.class, args);
    }
}

 

 

修改返回值之后,点击保存,项目自动重启。

截图如下:

技术分享

 

SpringBoot项目设置热部署

标签:art   截图   chapter   nbsp   style   自动   cti   client   com   

原文地址:http://www.cnblogs.com/mr-wuxiansheng/p/6971511.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!