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

     

  • 相关阅读:
    HDU 6182 A Math Problem 水题
    HDU 6186 CS Course 位运算 思维
    HDU 6188 Duizi and Shunzi 贪心 思维
    HDU 2824 The Euler function 欧拉函数
    HDU 3037 Saving Beans 多重集合的结合 lucas定理
    HDU 3923 Invoker Polya定理
    FZU 2282 Wand 组合数学 错排公式
    HDU 1452 Happy 2004 数论
    HDU 5778 abs 数论
    欧拉回路【判断连通+度数为偶】
  • 原文地址:https://www.cnblogs.com/yejiang/p/13168318.html
Copyright © 2011-2022 走看看