龙空技术网

阿里架构师带你入门Springboot!三分钟写“Hello,World”程序

今夜的头很冷 54

前言:

现在各位老铁们对“java的hello world怎么写”都比较关心,小伙伴们都想要分析一些“java的hello world怎么写”的相关文章。那么小编同时在网上搜集了一些关于“java的hello world怎么写””的相关知识,希望各位老铁们能喜欢,朋友们快快来学习一下吧!

写“Hello,World”程序!

同步滚动:

第一个springboot程序Hello,World

我们将学习如何快速的创建一个Spring Boot应用,并且实现一个简单的Http请求处理。通过这个例子对Spring Boot有一个初步的了解,并体验其结构简单、开发快速的特性。

我的环境准备:

java11Maven-3.6.3SpringBoot 2.x 最新版

开发工具:

IDEA一、创建Springboot项目

image

建议把服务连接换成阿里云的:

image

二、添加SpringWeb框架,再点击完成

image

三、可以选择删除多余文件

image

四、等待项目下载完成

image

五、springboot主启动类,springboot从这里开始跑

image

六、新建controller包

image

七、在controller包下新建HelloWorld类

package com.study.springboot01helloworld.controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;@RestControllerpublic class HelloWorld {    @RequestMapping("/hello")    public String HelloWorld01(){        return "HelloWorld";    }}

image

八、在Springboot主启动类启动项目

image

九、项目启动完成

1、启动完成提示

image

2、在网页中输入localhost:8080

image

3、在网页中输入localhost:8080/hello

image

分类: Springboot

标签: #java的hello world怎么写 #idea怎么写hello world