欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

SpringBoot

最编程 2024-10-04 13:20:16
...

1.SpringBoot的创建

 

hello.java

package com.leo.controller;


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

//请求处理类
@RestController

public class hello {
    @RequestMapping("/hello")

    public String hello(){
        System.out.println("hello world ");
           return "return hello world";
    }


    @RequestMapping("/hellos")

    public String hellos(){
        System.out.println("hello worlds ");
        return "return hello worlds";
    }
}

 

 springboot启动成功

 

hello的时候就  return hello world

hellos的时候就  return hello worlds

并且在控制台也有相应的输出句子打印出来