spring boot 入门操作(三)

spring boot入门操作

devtools热部署
  • pom dependencies里添加依赖

      <dependency>
          	<groupId>org.springframework.boot</groupId>
          	<artifactId>spring-boot-devtools</artifactId>
        	    <optional>true</optional>
         		<scope>true</scope>
      </dependency>	
    
  • 添加spring-boot-maven-plugin:

      <build>
      <plugins>
          <plugin>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-maven-plugin</artifactId>
              <configuration>
            		<!--fork :  如果没有该项配置,devtools不会起作用,即应用不会restart -->
                  <fork>true</fork>
              </configuration>
          </plugin>
      </plugins>
    
  • 新建类,加

  •   @RestController
    

注解,添加方法

  • localhost看是否能查到新的url。如果没有手动部署也能访问到新的url,说明ok
posted @ 2017-06-16 22:00  仙山泗水  阅读(136)  评论(0编辑  收藏  举报