1  idea 新建项目

               

     2  选择springboot 版本以及相关配置  创建好项目

               

   

    3    设置项目配置

              

   4     初始化的项目结构如下

         

 

 

 

 

  5 新建IndexController 

     

    

package com.example.demo.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class IndexController {

    @RequestMapping("/")
    public String index(){
        return " This is index pages ";
    }

    @RequestMapping("/hello")
    public String hello(){
        return " hello this is hello pages";
    }
}

 

 

 

    6 idea配置tomcat 启动    

       配置服务启动的端口号

       

 

       

         

       

       

 

    7 启动tomcat 测试看看效果

 

 

 

 

 

          

posted on 2023-09-04 11:51  ヽ坚强的蘑菇  阅读(23)  评论(0编辑  收藏  举报