SpringBoot入门程序

SpringBoot是由Pivotal团队提供的全新框架,其设计目的是用来简化Spring应用的初始搭建以及开发过程
SpringBoot入门程序

Spring程序缺点
配置繁琐
依赖设置繁琐
SpringBoot程序优点
自动配置
起步依赖(简化依赖配置)
辅助功能(内置服务器,……)

①:创建新模块,选择Spring初始化,并配置模块相关基础信息

②:选择当前模块需要使用的技术集

③:开发控制器类

package com.po.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

   @RestController
   @RequestMapping("/book")

public class BookController {


    @GetMapping("/{id}")
    public String getById(@PathVariable Integer id){
        System.out.println("id ==> "+ id);
        return "hello , spring boot! ";
    }


}

④:运行自动生成的Application类

 

 

posted @ 2023-02-16 15:32  __破  阅读(14)  评论(0)    收藏  举报