zoukankan      html  css  js  c++  java
  • 构建SpringBoot项目

    1.选择创建方式

     2.项目名

     3.选择项目依赖

     

     4. 添加webapp目录

     点击跳转查看

    添加web依赖(选web依赖后会自动添加,不用再添加)

       <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>

    application.properties文件配置

    注意端口不能冲突

    #配置端口号  项目名
    server.port=8080
    server.servlet.context-path=/springbootdemo

    写个测试的controller

    /**
     * @(#)WebTest.java, 2020/7/27.
     * <p/>
     * Copyright 2020 Netease, Inc. All rights reserved.
     * NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
     */
    package com.lhh.springbootdemo.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 lvhouhou(lvhouhou @ 163.com)
     */
    @RestController
    public class WebTest {
    
    
        @RequestMapping("hello")
        public String getHello(){
            return "Hello";
        }
    }

    启动项目

    浏览器访问  

    OK   

  • 相关阅读:
    Web应用程序并发问题处理的一点小经验
    *.pvr.ccz文件还原成png格式
    在python 中is和= = 的区别
    pyhton,数据类型
    python,序列化
    python, 操作文件和目录
    python文件,字符串,二进制的读写
    io编程,python
    python,错误、调试和测试
    python,多线程
  • 原文地址:https://www.cnblogs.com/lvhouhou/p/13388211.html
Copyright © 2011-2022 走看看