zoukankan      html  css  js  c++  java
  • springboot-helloworld实现

    springboot快速入门

    首先,建立一个空的项目

    第二步:

    建立一个springboot项目

     第三步:添加依赖:

    <?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>com.leyou.demo</groupId>
        <artifactId>springboot-demo</artifactId>
        <version>1.0-SNAPSHOT</version>
    
        <properties>
            <java.version>1.8</java.version>
        </properties>
    
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.0.0.RELEASE</version>
        </parent>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
        </dependencies>
    </project>
    

      第四步:编写控制器

    package com.java.controller;
    
    import org.springframework.stereotype.Controller;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.ResponseBody;
    import org.springframework.web.bind.annotation.RestController;
    
    /**
     * @author nidegui
     * @create 2019-05-26 10:15
     */
    @Controller
    public class HelloController {
    
        /**
         *
         * @return
         */
        @ResponseBody
        @RequestMapping("/hello")
        public String hello(){
            return  "springboot-nihao";
        }
    }
    

      第五步:启动application

    第六步:访问

  • 相关阅读:
    java封装
    本人的其他博客
    codeforces 1000C
    1005E1 Median on Segments (Permutations Edition) 【思维+无序数组求中位数】
    1009E Intercity Travelling 【数学期望】
    codeforces 1009D Relatively Prime Graph【欧拉函数】
    1077E Thematic Contests 【二分答案】
    codeforces 1077D Cutting Out 【二分】
    【非原创】ZOJ
    数字千万别用puts!
  • 原文地址:https://www.cnblogs.com/nidegui/p/10925298.html
Copyright © 2011-2022 走看看