springboot源码理解一、springboot源码环境搭建

准备工作

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

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

错误一

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。

不要使用阿里云仓库,否则一些依赖下载不到会报错,
用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。

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

mvn spring-javaformat:apply

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

导入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源码环境搭建完成。";
	}

}

project structure

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

run

在这里插入图片描述

访问

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

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值