SpringBoot 新手入门基础教程

本文介绍如何使用Spring Tool Suite 3.9.8创建Spring Boot项目,并通过示例演示了基本的RESTful API实现方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用工具 -- spring-tool-suite-3.9.8.RELEASE

下载地址:https://spring.io/tools

新建项目:File → New → Project

注意:入口类必须是在最外层,所有子类都得是它下层。

也就是说新增子类包路径得在入口包路径后再新增一层或多层。

如果当前入口类包路径是 com.example.demo

子类包路径则得在此基础上再加一层 com.example.demo.xx

 

具体测试类内容:

package com.example.demo.controller;

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

@RestController
public class helloWorld {
       @RequestMapping("/helloworld")
        public String home(){
            return "Hello, Zbook!";
        }
}

 

 

参考:https://www.extlight.com/2017/11/23/Spring-Boot-%E5%85%A5%E9%97%A8%E4%B9%8B%E5%9F%BA%E7%A1%80%E7%AF%87%EF%BC%88%E4%B8%80%EF%BC%89/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值