zoukankan      html  css  js  c++  java
  • 搭建springboot项目

    现在,更新我的第一篇博客,主要是为了记录下自己学习的过程,方便今后回顾

    今天的主题是搭建一个springboot项目,我们使用的工具是idea

    新建springboot项目

    如图,新建一个springboot项目

     

     

    主程序代码

    package com.example.demo;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    
    @SpringBootApplication
    public class DemoApplication {
    
        public static void main(String[] args) {
            SpringApplication.run(DemoApplication.class, args);
        }
    
    }

    controller示例代码

    package com.example.demo.controller;
    
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RestController;
    
    @RestController
    public class HelloWorldController {
        @RequestMapping("/hello")
        public String index(){
            return "Hello World!";
        }
    }

    启动成功

    这样,项目启动成功

    在浏览器输入http://localhost:8080/hello就可以访问了

    成功!

    天道酬勤,与君共勉

  • 相关阅读:
    Good Vegetable 4级算法题 分值: [320/3120] 问题: [8/78]
    Bitwise And Queries
    XD
    补题0%……计划进行中
    PC网页版、移动客户端、Wap版 有什么不同
    关于"软件评测师"
    POSTMAN-REST Client
    【NO.13】Jmeter
    【NO.12-1】Jmeter
    【NO.11】Jmeter
  • 原文地址:https://www.cnblogs.com/lwhblog/p/10574279.html
Copyright © 2011-2022 走看看