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就可以访问了

    成功!

    天道酬勤,与君共勉

  • 相关阅读:
    AutoCompleteTextView控件的使用
    menu菜单
    fragment之间的通信
    fragment的生命周期
    用模型取代字典的好处
    使用fragment兼容低版本的写法
    模拟微信主界面
    动态替换fragment
    fragment入门
    Spring MVC学习总结(1)——Spring MVC单元测试
  • 原文地址:https://www.cnblogs.com/lwhblog/p/10574279.html
Copyright © 2011-2022 走看看