zoukankan      html  css  js  c++  java
  • SpringBoot快速开始

    用maven创建第一个SpringBoot项目

    一、创建maven项目

     

     

    二、添加springboot的maven依赖

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>muyer-springboot</groupId>
        <artifactId>quickStart</artifactId>
        <version>1.0-SNAPSHOT</version>
    
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.9.RELEASE</version>
        </parent>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
        </dependencies>
    </project>

    三、创建相关类和配置文件

    1.创建启动类

    @SpringBootApplication
    public class QuickStartpApp {
        public static void main(String[] args) {
            SpringApplication.run(QuickStartpApp.class,args);
        }
    }

    2.创建controller

    @RestController
    public class HelloSpringBoot {
        @RequestMapping(value = "/hello", method = RequestMethod.GET)
        public String helloSpringBoot() {
            return "hello springboot";
        }
    }

    3.创建配置文件

    server.port=8090

    4.类在项目中的结构

     四、启动测试

    1.点击启动类左边的启动按钮

    2.浏览器输入请求地址:http://localhost:8090/hello

     

  • 相关阅读:
    Linux下编译安装redis
    docker搭建swoole的简易的聊天室
    Linux下面安装swoole
    laravel命令
    史上最污技术解读,60 个 IT 术语我竟然秒懂了.....
    redis集群搭建
    Windows安装MongoDB
    十大经典排序算法(动图演示)
    消息中间件基础
    laravel邮件发送
  • 原文地址:https://www.cnblogs.com/yejiang/p/13168318.html
Copyright © 2011-2022 走看看