SpringBoot基础入门(二)

一:Springboot基础入门第二天

  1.1 代码解析

      @SpringBootApplication:标注SpringBoot的启动类

       SpringBootApplication.run:代表运行SpringBoot的启动类,参数为SpringBoot启动类的字节码对象

  1.2 SpringBoot工程热部署

      我们在开发中反复修改类、页面等资源,每次修改后都是需要重新启动才生效,这样每次启动都很麻烦,浪费了大

量的时间,我们可以在修改代码后不重启就能生效,在pom.xml中添加如下配置就可以实现这样的功能,我们称
之为热部署。

      

 

      注意:有的时候IDEA进行SpringBoot热部署失败的原因,其实就是因为IDEA默认情况下是不会自动编译的,所以我们需要对其进行设置

      

 

      然后按键盘上的 Shift + Ctrl + Alt + / ,然后选择Registry

 

       

 

    

  1.3 使用idea快速创建SpringBoot项目

      

 

       

 

       

 

      以上我们就通过IDEA创建好了我们的SpringBoot项目,此时我们的项目文件:pom.xml 中已经导入了我们选择的Web的起步依赖

      

二:SpringBoot原理分析

     2.1 分析spring-boot-starter-parent

          按住键盘上的Ctrl点击pom.xml中的 spring-boot-starter-parent,跳转到它的相关配置中

           

 

           然后按住Ctrl点击pom.xml中的spring-boot-starter-dependencies,跳转到了spring-boot-starter-dependencies

pom.xmlxml配,由于代码比较多,所以这我就不一一进行复制了
          从上面的spring-boot-starter-dependenciespom.xml中我们可以发现,一部分坐标的版本、依赖管理、插件管

理已经定义好,所以我们的SpringBoot工程继承spring-boot-starter-parent后已经具备版本锁定等配置了。所以

 

起步依赖的作用就是进行依赖的传递。

           

 

posted @ 2020-05-11 20:00  小学生学Web前端  阅读(184)  评论(1)    收藏  举报