Spring Boot 源码阅读初始化环境搭建

2023-05-16

在开始源码阅读之前,需要先搭建一个简易的SSM环境用于测试,这里不过解释怎么搭建,相信都开始看源码了,还不会搭建Demo环境就先去学习下基础。

demo环境地址:https://github.com/jujunchen/Spring-Boot-Demo.git

版本统一:

工具:IDEA

JDK:jdk11

Spring Boot 版本:2.7.9

Mybatis Plus 版本:3.5.2

使用 Spring Initializr 创建一个项目

image-20230123145753844

项目pom.xml文件如下

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.9-SNAPSHOT</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    
    <groupId>com.springboot</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>Spring-Boot-Demo</name>
    <description>Spring-Boot-Demo</description>
    
    <properties>
        <java.version>11</java.version>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.5.2</version>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <releases>
                <enabled>false</enabled>
            </releases>
        </pluginRepository>
    </pluginRepositories>

</project>

application.yml文件配置如下

# Mysql数据库
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/spring-boot-demo?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT&nullCatalogMeansCurrent=true
    username: root
    password: 123456

启动项目,打印出如下日志

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v2.7.9-SNAPSHOT)

2023-01-23 15:23:41.614  INFO 78768 --- [           main] c.s.demo.SpringBootDemoApplication       : Starting SpringBootDemoApplication using Java 11.0.16.1 on 192.168.0.113 with PID 78768 (/Users/chenjujun/java-projects/Spring-Boot-Demo/Spring-Boot-Demo/target/classes started by apple in /Users/chenjujun/java-projects/Spring-Boot-Demo/Spring-Boot-Demo)
2023-01-23 15:23:41.615  INFO 78768 --- [           main] c.s.demo.SpringBootDemoApplication       : No active profile set, falling back to 1 default profile: "default"
2023-01-23 15:23:41.899  WARN 78768 --- [           main] o.m.s.mapper.ClassPathMapperScanner      : No MyBatis mapper was found in '[com.springboot.demo]' package. Please check your configuration.
2023-01-23 15:23:42.070  INFO 78768 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-01-23 15:23:42.075  INFO 78768 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-01-23 15:23:42.075  INFO 78768 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.71]
2023-01-23 15:23:42.127  INFO 78768 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-01-23 15:23:42.127  INFO 78768 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 492 ms
 _ _   |_  _ _|_. ___ _ |    _ 
| | |\/|_)(_| | |_\  |_)||_|_\ 
     /               |         
                        3.5.2 
2023-01-23 15:23:42.368  INFO 78768 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2023-01-23 15:23:42.376  INFO 78768 --- [           main] c.s.demo.SpringBootDemoApplication       : Started SpringBootDemoApplication in 0.982 seconds (JVM running for 1.447)

OK,环境可以用了。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Spring Boot 源码阅读初始化环境搭建 的相关文章

随机推荐

  • docker下gitlab安装配置使用(完整版)

    docker 安装gitlab以及使用 一 安装及配置 1 gitlab镜像拉取 gitlab ce为稳定版本 xff0c 后面不填写版本则默认pull最新latest版本 docker pull gitlab gitlab ce 拉取镜像
  • Linux 配置Gradle

    一 下载gradle 如果windows中有可以直接拷贝 xff0c 如果没有可以去官网下载 http www gradle org downloads 二 解压下载得到的gradle unzip gradle 2 2 1 all zip
  • gitlab配置通过smtp发送邮件(QQ exmail腾讯企业为例)

    首先祭出官网文档链接 xff1a https docs gitlab com omnibus settings smtp html 其实官网已经说的很清楚了 xff0c 并且给出了QQ邮箱的范例 xff08 BAT还是屌的 xff09 1
  • 文本编辑器Notepad++使用技巧

    除了语法高亮 xff0c 一般不用操作 还有两点经常使用的 xff1a 正则表达式查找替换和列模式编辑 这些可以在VS Eclipse Word等里也有 xff0c 但是有时打开一个文件就慢了 本来想总结记录一下技巧的 xff0c 却无意中
  • linux系统磁盘block、inode占满处理

    1 磁盘的block占满 xff0c 查看命令 df vh 然后查看占用百分比 2 磁盘inode占满 xff0c 查看命令df ih 同样也是查看占用百分比 block占满处理办法 需要用到的命令如下 LL 列出当前目录下的文件 df v
  • Code::Blocks平台下Fortran的编译

    问题背景 xff1a 因为之前学习数值方法 xff0c 有用到Fortran的地方 xff0c 所以上网查了一些资料 关于Fortran语言的编辑器安装 xff0c 目前本人接触到的支持Fortran的编辑器有VisualStdio和Cod
  • powershell远程连接

    在Linux中 xff0c 我们可以使用安全的SSH方便的进行远程管理 但在Windows下 xff0c 除了不安全的Telnet以外 xff0c 从Windows Server 2008开始提供了另外一种命令行原创管理方式 xff0c 那
  • 2022年学习总结暨2023年规划

    2022年总结 2022年是我在C站的创作元年 xff0c 在第一年也收获了不少成就 xff0c 比如 Java领域新星创作者 发布100篇博文 拿到了C站的书包 吃到了C站的月饼 成功上榜了330 43 截止目前收获粉丝8600 43 在
  • 《Prometheus+Grafana 实践派》专栏介绍

    专栏名称 Prometheus 43 Grafana 实践派 专栏介绍 本专栏根据本公司统一监控落地实践编写 在该专栏您将学到 企业级监控的选型Prometheus的基础知识Grafana的基础知识快速搭建Prometheus 43 Gra
  • 泊松分布–计算概率分布的公式

    Probability Distributions play an important role in our daily lives We commonly use them when trying to summarise and ga
  • Prometheus 的介绍和安装

    介绍 Prometheus 是一个开源的监控和报警系统 最初由SoundCloud于2012年创建 随着越来越多的公司采用Prometheus以及非常活跃的社区 Prometheus于2016年加入云原生基金会 成为Kubernetes之后
  • 因为锁的问题,我们被扣了1万

    前言 春节放假期间 xff0c 一个项目上的积分接口被刷 xff0c 而且不止一个人在刷 xff0c 并且东西也被兑走 xff0c 放假晚上被人叫起来排查问题 xff0c 通过这个人的积分明细观察 xff0c 基本一秒就能获取一次 xff0
  • Prometheus 告警机制介绍及命令解读

    本文您将了解到Prometheus 告警模块Alertmanager的架构介绍 核心概念 命令解析和AMTool的基本使用 Prometheus的告警模块并不存在于Prometheus中 而是 以独立项目Alertmanager存在 Pro
  • Prometheus 告警模块配置深度解析

    本文您将了解到Prometheus 告警模块Alertmanager 配置的深度解析 Alertmanager 配置解析 Alertmanager 配置可以用命令行配置 也可以通过配置文件配置 命令行用来配置不可变的系统参数 配置文件用来定
  • 不会前端没事,用GWT Boot和Spring Boot构建Web程序

    本文介绍了一种使用Java构建Web应用程序的方式 xff0c 其中GWT或者J2CL是必不可少的 xff0c 另外还有多个UI框架可以配套使用 xff0c 比如Domino UI VueGWT GWT Material Design GM
  • Prometheus 监控云Mysql和自建Mysql(多实例)

    本文您将了解到 Prometheus如何配置才能监控云Mysql 包括阿里云 腾讯云 华为云 和自建Mysql Prometheus 提供了很多种Exporter 用于监控第三方系统指标 如果没有提供也可以根据Exporter规范自定义Ex
  • 2023年 Java 发展趋势

    GitHub 语言统计表明 xff0c Java在编程语言中排名第二 xff0c 而在2022年的TIOBE指数中 xff0c Java排在第四 抛开排名 xff0c Java是自诞生以来企业使用率最高的编程语言 xff0c 作为一种编程语
  • Spring Boot 中文参考指南(二)-Web

    Spring Boot 版本 2 7 8 原文 xff1a https docs spring io spring boot docs 2 7 8 reference htmlsingle Spring Boot 3 x 第一个 GA 版本
  • Java 编写Vue组件(VueGWT的初尝试)

    在之前 xff0c 我曾写过这样的文章 不会前端没事 xff0c 用GWT Boot和Spring Boot构建Web程序 xff0c 这篇文字使用的Domino UI来做前端页面 xff0c 由于现在更流行VUE xff0c 并且VUE的
  • Spring Boot 源码阅读初始化环境搭建

    在开始源码阅读之前 xff0c 需要先搭建一个简易的SSM环境用于测试 xff0c 这里不过解释怎么搭建 xff0c 相信都开始看源码了 xff0c 还不会搭建Demo环境就先去学习下基础 demo环境地址 xff1a https gith