本文通过Eclipse Maven 构建第一个SpringBoot小实例Demo。

 

1、创建maven项目

SpringBoot第一个Demo实例 Hello World!

SpringBoot第一个Demo实例 Hello World!
SpringBoot第一个Demo实例 Hello World!
SpringBoot第一个Demo实例 Hello World!
SpringBoot第一个Demo实例 Hello World!

SpringBoot第一个Demo实例 Hello World!

 

2、创建测试类

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 Test {
    
    @RequestMapping("/")
    String home(){
        return "Hello springboot!";
    }
    
    public static void main(String args[]){
        SpringApplication.run(Test.class,args);
    }

}

SpringBoot第一个Demo实例 Hello World!

 

3 启动Demo 
运行Test.class类

SpringBoot第一个Demo实例 Hello World!

4、查看效果

浏览器输入http://localhost:8080/ 
SpringBoot第一个Demo实例 Hello World!

相关文章:

  • 2022-12-23
  • 2021-04-24
  • 2021-07-30
  • 2021-04-13
  • 2022-12-23
  • 2022-01-01
  • 2021-06-14
猜你喜欢
  • 2021-10-04
  • 2022-01-04
  • 2021-06-24
  • 2021-09-15
  • 2021-12-29
  • 2022-12-23
相关资源
相似解决方案