zoukankan      html  css  js  c++  java
  • spring boot -- helloworld

    1.在idea中创建maven项目


    2.在pom.xml中添加依赖

        <packaging>pom</packaging>
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.3.0.RELEASE</version>
        </parent>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
        </dependencies>
    

    3.新建子工程


    4.在子工程中创建controller

    package com.sfencs.first;
    
    
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RestController;
    
    @RestController
    public class TestController {
    
        @RequestMapping("hello")
        public String hello() {
            return "hello world";
        }
    }
    

    5.创建springboot启动类

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

    6.运行启动类main函数

    浏览器输入http://localhost:8080/hello

  • 相关阅读:
    数据库
    流式布局
    ScrollView简单用法
    ADB被占用解决办法
    安卓中shape中的属性大全
    sql语句replace into的用法
    debug
    大数据量数据库优化
    Gson解析后的数据存到本地数据库 耗时的问题
    数据同步异步加载handler Looper
  • 原文地址:https://www.cnblogs.com/sfencs-hcy/p/13474836.html
Copyright © 2011-2022 走看看