码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • springboot源码理解一、springboot源码环境搭建


    springboot源码环境搭建

    • 准备工作
    • springboot源码下载
    • 解压
    • 编译源码
      • 打包
      • 错误一
      • 错误二
    • 导入idea
      • maven配置
      • 导入项目
      • 新建module
        • spring-boot-mytest
        • 修改spring-boot-mytest的pom.xml
        • 修改spring-boot-2.2.9.RELEASE的pom.xml
        • 刷新项目
        • 添加controller
        • project structure
        • run
        • 访问

    准备工作

    jdk版本:“1.8.0_171”,maven版本:3.8.6。
    在这里插入图片描述

    springboot源码下载

    地址:https://github.com/spring-projects/spring-boot/tags

    2.2.9.RELEASE,2.3.0以上版本需要用gradle构建,会比较麻烦。
    在这里插入图片描述

    解压

    在这里插入图片描述

    编译源码

    打包

    跳过测试,能节省很多时间。

    mvn clean install -DskipTests
    
    • 1

    在这里插入图片描述
    时间可能会很长。

    错误一

    This failure was cached in the local repository and resolution is not reattempted until the update interval of nexus-aliyun has elapsed or updates are forced. Original error: Could not transfer artifact。

    This failure was cached in the local repository and resolution is not reattempted until the update interval of nexus-aliyun has elapsed or updates are forced. Original error: Could not transfer artifact。
    
    • 1

    不要使用阿里云仓库,否则一些依赖下载不到会报错,
    用maven自带的setting.xml。

    错误二

    Failed to execute goal io.spring.javaformat:spring-javaformat-maven-plugin:0.0.22:validate (default) on project spring-boot-test-support: Formatting violations found in the following files。

    Failed to execute goal io.spring.javaformat:spring-javaformat-maven-plugin:0.0.22:validate (default) on project spring-boot-test-support: Formatting violations found in the following files。
    
    • 1

    在这里插入图片描述
    先运行:

    mvn spring-javaformat:apply
    
    • 1

    在这里插入图片描述
    然后再打包。
    在这里插入图片描述

    导入idea

    maven配置

    在这里插入图片描述

    导入项目

    在这里插入图片描述

    新建module

    这样是为了方便我们debug调试。

    spring-boot-mytest

    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

    修改spring-boot-mytest的pom.xml

    修改spring-boot-mytest的springboot版本号为:‘2.2.9.RELEASE’。
    在这里插入图片描述

    修改spring-boot-2.2.9.RELEASE的pom.xml

    添加module。
    在这里插入图片描述

    刷新项目

    在这里插入图片描述

    添加controller

    在这里插入图片描述

    package com.duohoob.springbootmytest.controller;
    
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RestController;
    
    @RestController
    public class TestController {
    
    	@RequestMapping("/test")
    	public String test() {
    		return "springboot源码环境搭建完成。";
    	}
    
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    project structure

    选中模块→src/main/java→sources。
    在这里插入图片描述

    run

    在这里插入图片描述

    访问

    http://localhost:8080/test
    在这里插入图片描述

  • 相关阅读:
    不安装运行时运行.NET程序
    Python —— pytest框架
    集合——List接口:关于ArrayList、LinkedList和Vector的区别
    Zookeeper-3.8.0集群搭建
    亚马逊云科技持续创新、领势而行,re:Invent颠覆想象
    【Python基础知识】(16)Range的经典用例
    asp.net社区医疗辅助诊断网站系统VS开发sqlserver数据库web结构c#编程
    Training language models to follow instructions with human feedback 论文阅读
    Chromium 通过IDL方式添加扩展API
    实战项目:负载均衡式在线OJ
  • 原文地址:https://blog.csdn.net/qq_35549286/article/details/126862499
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | 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号