SpringBoot第一节

1.创建一个StringInitializr项目(步骤如下)

  (1)

  

  (2)

  

  (3)

  

 

   (4)

  

 

2、DemoApplication类

复制代码
package com.example.demo;

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

@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})
public class DemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

}
复制代码

3、创建Controller类

复制代码
package com.example.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class sss {
    @RequestMapping("/hello")
    @ResponseBody
    public String deom(){
        return "Hello Word!!!";
    }
}
复制代码

4、启动控制台DemoApplication类,运行结果如下

 5、启动页面,运行结果如下

posted @ 2019-12-04 16:47  开始刷卡  阅读(183)  评论(0编辑  收藏  举报