springBoot测试1

Eclipse安装spring-tool-suite插件
用于构建微服务
Spring boot starter
WebJars主官网

pom.xml


  4.0.0

  com.yue.practise
  springboot
  0.0.1-SNAPSHOT
  
  
        org.springframework.boot
        spring-boot-starter-parent
        1.4.3.RELEASE
  

  springboot
  http://maven.apache.org

  
    UTF-8
  

  
    
      org.springframework.boot
      spring-boot-starter-web
    
  

    
        
        
            org.springframework.boot
            spring-boot-maven-plugin
        
    


A.java

package com.yue.practise.springboot;

import java.util.Date;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@EnableAutoConfiguration
public class A {

    @RequestMapping("/")
    String home(){
        return "hello world "+new Date();
    }
    
    public static void main(String[] args) {
        SpringApplication.run(A.class, args);
    }
}

mvn spring-boot:run
http://localhost:8080/

springBoot测试1_第1张图片
Paste_Image.png

mvn package
在target下看到jar包,cmd下运行

Paste_Image.png
java -jar springboot-0.0.1-SNAPSHOT.jar

启动成功,http://localhost:8080/

springBoot测试1_第2张图片
Paste_Image.png

ctrl+c退出

  1. 不继承spring-boot-starter-parent

            
            org.springframework.boot
            spring-boot-dependencies
            1.4.0.RELEASE
            pom
            import
        
  1. 热部署

    
        org.springframework.boot
        spring-boot-devtools
        true
   


    
        
            org.springframework.boot
            spring-boot-maven-plugin
            
                true
            
        
   

你可能感兴趣的:(springBoot测试1)