SpringBoot入门

Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。通过这种方式,Spring Boot致力于在蓬勃发展的快速应用开发领域(rapid application development)成为领导者。
springBoot 入门 微服务

1.创建maven工程

2.配置pom文件



    4.0.0

    com.xmg.demo
    demo1
    1.0-SNAPSHOT

    
    
        1.7
    

    
        org.springframework.boot
        spring-boot-starter-parent
        1.5.9.RELEASE
        
    
    
        
        
            org.springframework.boot
            spring-boot-starter-web
        

        
        
            org.springframework.boot
            spring-boot-devtools
        
    

3.启动文件 在src下面新建文件文件名一般为Application.java

package com.xmg.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

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

}

4.新建控制器

package com.xmg.demo;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloWroldController {
    @RequestMapping("/info")
    public String info(){
        return "HelloWorld!!";
    }
}

5.启动

  • Application里面运行
    点击运行/右键运行

6.idea要想实现热更新需要配置

Linux/Windows:【Ctrl】+【Alt】+【Shift】+【/】
Mac:【Command】+【Alt】+【Shift】+【/】
改一下就好了

持续更新实用的干货
coderYJ
微博coderYJ
微信公众号coderYJ

你可能感兴趣的:(SpringBoot入门)