Springboot源码怎么分析项目结构

发布时间:2021-10-20 10:28:36 作者:柒染
来源:亿速云 阅读:107

Springboot源码怎么分析项目结构,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

Springboot源码分析之项目结构

摘要:
parent标签的含义
关注点
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>2.1.6.RELEASE</version>
        <relativePath>../../spring-boot-dependencies</relativePath>
      </parent>
    ```

说明我们的工程可以进行改造进行替换掉原来工程的`parent`标签.

-     <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                  <execution>
                    <id>repackage</id>
                    <goals>
                      <goal>repackage</goal>
                    </goals>
                  </execution>
                </executions>
                <configuration>
                  <mainClass>${start-class}</mainClass>
                </configuration>
              </plugin>
 ` repackage`必须要有否则打jar包时候无法正常启动.
 ![file](https://cache.yisu.com/upload/information/20210524/347/779545.jpg)

在配置文件加上`repackage`即可

    <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>

`IDEA`自带`maven`工具

![file](https://cache.yisu.com/upload/information/20210524/347/779546.jpg)

`mvnw`是基于`linux`的`shell`脚本命令

`mvnw.cmd`是基于`windows`的脚本命令

`.mvn`包含了` maven`下载路径以及版本等信息

也就是说我们完全不用自己下载`maven`而是可以直接使用`IDEA`给我们提供的工具即可,只不过通常不会这么做。
#### `repackage`的作用

- [官方文档](https://docs.spring.io/spring-boot/docs/current/maven-plugin/repackage-mojo.html)
- 正常情况下打包会生成`springboot-0.0.1-SNAPSHOT.jar`,`original,springboot-0.0.1-SNAPSHOT.jar`这样的2个文件,而`repackage`的作用就是将`springboot-0.0.1-SNAPSHOT.jar.original`重新打包为我们可以执行的`springboot-0.0.1-SNAPSHOT.jar`

关于Springboot源码怎么分析项目结构问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注亿速云行业资讯频道了解更多相关知识。

推荐阅读:
  1. iot平台thingsboard源码阅读之项目结构分析
  2. 【原创】002 | 搭上SpringBoot事务源码分析专车

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

spring boot

上一篇:net.ipv4.tcp_tw_recycle配置问题是什么

下一篇:Python与C++的速度有哪些区别

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》