码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • SpringBoot SpringBoot 基础篇 1 快速上手SpringBoot 1.4 SpringBoot 入门程序开发【手工制作版】


    SpringBoot

    【黑马程序员SpringBoot2全套视频教程,springboot零基础到项目实战(spring boot2完整版)】

    SpringBoot 基础篇

    文章目录

        • SpringBoot
        • SpringBoot 基础篇
        • 1 快速上手SpringBoot
          • 1.4 SpringBoot 入门程序开发【手工制作版】
            • 1.4.1 手工制作SpringBoot 工程
            • 1.4.2 小结

    1 快速上手SpringBoot

    1.4 SpringBoot 入门程序开发【手工制作版】
    1.4.1 手工制作SpringBoot 工程

    创建新模块【Maven 项目】

    在这里插入图片描述

    直接创建

    在这里插入图片描述

    一个干净的Maven 工程

    修改pom.xml 文件

    <parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>2.7.4version>
    parent>
    
    • 1
    • 2
    • 3
    • 4
    • 5

    在这里插入图片描述

    <dependencies>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-webartifactId>
        dependency>
    
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-testartifactId>
            <scope>testscope>
        dependency>
    dependencies>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    在这里插入图片描述

    这样第一步就完成了【记得刷一下】

    接下来手写引导类

    在这里插入图片描述

    package com.dingjiaxiong;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    
    /**
     * ClassName: Application
     * date: 2022/10/15 19:32
     *
     * @author DingJiaxiong
     */
    
    @SpringBootApplication
    public class Application {
    
        public static void main(String[] args) {
            SpringApplication.run(Application.class);
        }
    
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    添加控制器

    package com.dingjiaxiong.controller;
    
    import org.springframework.web.bind.annotation.GetMapping;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RestController;
    
    /**
     * ClassName: BookController
     * date: 2022/10/15 18:42
     *
     * @author DingJiaxiong
     */
    
    //REST模式
    @RestController
    @RequestMapping("/books")
    public class BookController {
    
        @GetMapping
        public String getById(){
            System.out.println("SpringBoot is running...444");
            return "SpringBoot is running...444手工制作牛逼!";
        }
    
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25

    在这里插入图片描述

    OK,启动服务器

    在这里插入图片描述

    测试接口

    在这里插入图片描述

    就是这样。

    1.4.2 小结
    1. 创建普通Maven工程
    2. 继承spring-boot-starter-parent
    3. 添加依赖spring-boot-starter-web
    4. 制作引导类Application
  • 相关阅读:
    Windows的内存管理机制
    Code-Audit(代码审计)习题记录4-5
    Mybiosource丨Mybiosource重组病毒果蝇蛋白wntless方案
    [C++]Leetcode17电话号码的字母组合
    BLE错误码全面解析&连接失败原因错误码解析&BLE Disconnect Reason
    神经网络建模的基本思想,神经网络语言模型详解
    题解_notion(持续更新ing)
    docker在java项目中打成tar包
    网络通信基础
    bp利率最新消息是多少,bps利率是什么意思
  • 原文地址:https://blog.csdn.net/weixin_44226181/article/details/127743553
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号