0
点赞
收藏
分享

微信扫一扫

SpringBoot基础学习3——入门案例(阿里云版)

野见 2022-04-15 阅读 67
java

系列文章目录

提示:这里可以添加系列文章的所有文章的目录,目录需要自己手动添加
例如:第一章 Python 机器学习入门之pandas的使用


SpringBoot基础学习3——入门案例(阿里云版)


提示:以下是本篇文章正文内容,下面案例可供参考

一、创建新的模块

(1)
在这里插入图片描述
(2)基于阿里云创建项目,地址:https://start.aliyun.com
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

二、编写开发控制类

在这里插入图片描述

package com.yan.controller;

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

//Rest模式
@RestController
@RequestMapping("/books")
public class BookController {

    @GetMapping
    public String getById(){
        System.out.println("SpringBoot is running...3");
        return "SpringBoot is running...3";
    }

}

运行自动生成的Application类,在浏览器输入下面的网址:

http://localhost:8080/books

运行结果:
在这里插入图片描述
在这里插入图片描述

三、其他

(1)注意事项

  1. 阿里云提供的坐标版本较低,如果需要使用高版本,进入工程后手工切换SpringBoot版本
  2. 阿里云提供的工程模板与Spring官网提供的工程模板略有不同

(2)小结

  1. 选择start来源为自定义URL
  2. 输入阿里云start地址
  3. 创建项目
举报

相关推荐

0 条评论