创建spring boot项目

使用https://start.aliyun.com/ 创建一个spring boot项目

1、打开https://start.aliyun.com/,获取代码

2、解压下载后文件,使用ide打开,pom。xml文件添加,install一下

xml 复制代码
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

3、建一个Controller文件

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


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

@RestController
public class HelloController {

    @GetMapping("/hello")
    public String hello(){
        return "hello spring,boot";
    }
}

4、运行DemoApplication.java文件

5、打开http://localhost:8080/hello

相关推荐
逝水无殇7 分钟前
C# 字符串(String)详解
开发语言·后端·c#
神奇小汤圆44 分钟前
牛客网Java八股文|2026秋招面试题汇总(金九银十冲刺专用)
后端
cfm_29141 小时前
SpringBoot MockMvc
spring boot·后端·log4j
神奇小汤圆1 小时前
你的Java天花板,不是Spring Boot,是思维方式
后端
梨子同志1 小时前
Maven
后端
用户41659673693551 小时前
堡垒机 Web CLI 部署教程
后端
xiyueyezibile1 小时前
“自迭代” Skill 的 team-pitfalls 的演进
前端·后端·ai编程
叫我少年1 小时前
C# StringBuilder 基础入门
后端
会写代码的建筑师1 小时前
C# 源生成器使用方法
后端·架构
用户638982245891 小时前
Poi-Tl根据word模板生成合并表头使用
后端